I have a scenario to validate the "status" value in the array. The response is dynamic and # iteration may vary. I don't want to save this value in my postman environment but need to make a dynamic check. From my below API Response, I got 2 instances, 1st with AVAILABLE, 2nd with SOLDOUT. Can someone suggest to me how do I make the comparison?
Response API:
[
{
"status": "AVAILABLE",
"price": {
"baseAveragePrice": 209,
"discountedAveragePrice": 209
},
"Fee": 39,
"flag": false
},
{
"status": "SOLDOUT",
"price": {
"baseAveragePrice": 209,
"discountedAveragePrice": 209
},
"Fee": 39,
"flag": true
},
]
pm.test("status Check", function () {
var jsonData = pm.response.json();
pm.expect(jsonData.status).to.be.oneOf(["AVAILABLE", "SOLDOUT", "NOTRELEASED"]);
});