How to check if object is present in array of objects? #1888
Unanswered
finlaydotb
asked this question in
Q&A
Replies: 1 comment
|
Hi @finlaydotb, sorry for the late answer. Currently, you can only test for "leaf" in asserts (the right side XXX of this: You can change your test from this:
You can also use filters on JSONPath queries:
Or
This can be seems as restrictive but for the moment we don't have good syntax/spec for what you want. We need to define what would be a right answer if the test has been |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I am using https://hurl.dev/ for testing, and I have an endpoint that returns an array of objects.
Now I want to assert that this array of object contains a particular array.
How do I do this?
I have tried
got the error
tried
Got the error
This seems to be closer to getting it, but looks like there is a mismatch in types? Also how do I avoid having to manually escape the json string myself.
To try and get the type correct and also not to manually escape the json, I tried
but got the error
So question is, if I have an endpoint that returns an array of objects, how do I assert that the response contains/includes a particular object?
All reactions