Skip to content

Validate Json Response by the negative #239

Answered by axelbarfod
axelbarfod asked this question in Q&A
Discussion options

You must be logged in to vote

Tried using the notIncludes but I keep getting the error:

AssertionError [ERR_ASSERTION]: Json doesn't have a "object" at "$.sendBirdAccessToken"

Here is my sample test:

await spec()
            .get(base_url + /users/123`)
            .expectJsonMatch({
                'sendBirdAccessToken': notIncludes('sendBirdAccessToken')
});

This is the response from my API:

{ "id": "someid", "username": "ovz1wot3e", "email": "[email protected]", "dateOfBirth": null, "sendBirdAccessToken": "token", "products": [], "myReviews": [], "kyc": null, "deliveryAddresses": [ ] }

I want to validate that the sendBirdAccessToken isn't sent on the response.

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@ASaiAnudeep
Comment options

@axelbarfod
Comment options

Answer selected by axelbarfod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants