'Want to assert that the values are not duplicated in the list

I'm asserting a response like this using karate.

"Ids": ["123456","123456","123457"]

Now I want to assert that my list doesn't contain the duplicate values (If there is a duplicate value, it should fail the test-case), is there any in built function which is supported by Karate or is there any JS who does the trick?



Solution 1:[1]

Here you go: https://github.com/karatelabs/karate#karate-distinct

* def response = ["123456","123456","123457"]
* match response == karate.distinct(response)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Peter Thomas