quick question on matches: I was under the (wrong)...
# pact-js
u
quick question on matches: I was under the (wrong) impression that
atLeastOneLike
meant "check this array, and at least 1 element in it should be like the template", but it turns out that's not it. What's the best way to check that there's at least 1 item in an array of varied items that conforms to the template?
m
I think that’s the correct interpretation of it. Additionally, if there are more than 1 items in the array, they all must match the template also
arrayContaining
says - “this array can be of any length and contain any objects, but it must have at at least one object that matches this template”
subtly different
t
It looks like
atLeastOneLike
is a synonym for
eachLike
- I’m not sure when it was added, but I agree it’s misnamed
u
so,
arrayContaining
is what I need (I have a heterogeneous array in my response) and I want to check that 1 item matches the template, Y/n?
1
t
yes
u
lovely, thanks!