Reputation: 3978
I know that i can check a specific value in a specific index, for example - to check for the value at index 0:
sinon.assert.match(myArr[0], someValue)
But how do i check if someValue
is anywhere in myArr
?
Upvotes: 0
Views: 842
Reputation: 2501
Here is one way you could do it if you don't want to create a loop that iterates through each element.
myArr.includes(someValue);
I haven't tried it with sinon, but see if this works:
assert.equals(myArr.includes(someValue), true);
// or
assert(myArr.includes(someValue));
Upvotes: 1