Reputation: 109
I have the following assertion in my postman script test, but for some reason the tests are failing when one of the following is missing: Lease, Finance, or cash in my response body. Is the "||" not the OR operator?
tests["Deal Type"] = responseBody.has("Lease" || "Finance" || "Cash");
Upvotes: 8
Views: 18078
Reputation: 61
Write it is like this..
pm.expect(pm.response.data[0].DealType).to.be.oneOf(['Lease', 'Finance','Cash']);
Upvotes: 6
Reputation: 312
It should be something like:
pm.expect(pm.response.code).to.be.oneOf([201,202]);
Upvotes: 13
Reputation: 133
According to the postman docs the correct syntax would be
tests["Deal Type"] = responseBody.has("Lease") || responseBody.has("Finance") || responseBody.has("Cash");
Upvotes: 6