add unique check to test case
@@ -237,4 +237,18 @@ func TestMakeRequestFromModelUniqueInteractsh(t *testing.T) {
require.NotContains(t, got.request.URL.String(), "{{interactsh-url}}", "could not get correct interactsh url")
// check the length of returned urls
require.Equal(t, len(got.interactshURLs), 4, "could not get correct interactsh url")
+ // check if the interactsh urls are unique
+ require.True(t, areUnique(got.interactshURLs), "interactsh urls are not unique")
+}
+
+// areUnique checks if the elements of string slice are unique
+func areUnique(elements []string) bool {
+ encountered := map[string]bool{}
+ for v := range elements {
+ if encountered[elements[v]] {
+ return false
+ }
+ encountered[elements[v]] = true
+ }
+ return true
}
