Hi everybody! i have response like this and i need check all expirationDate. They must be above today date. Can’t find here how can i check all of this, help me please) thanks
[
{
“id”: “ec1e91b3-518e-47f7-9ac2-37ac3736cde9”,
“subscriber”: “user”,
“expirationDate”: “2023-01-19”,
“payload”: “TEST 53885635”,
“format”: “310”,
“creationDate”: “2023-01-19T14:36:22.558643”,
“modificationDate”: “2023-01-19T14:36:22.55865”,
“isRead”: false
},
{
“id”: “1ca74ba7-851a-4328-8f41-8aaed95f9f9d”,
“subscriber”: “user”,
“expirationDate”: “2023-01-19”,
“payload”: “TEST 80144708”,
“format”: “792”,
“creationDate”: “2023-01-19T14:16:42.000603”,
“modificationDate”: “2023-01-19T14:16:42.000623”,
“isRead”: false
}
]
i have allready trying check one object of array, but its failed “AssertionError: expected ‘2023-01-19’ to be a number or a date”
const responseJson = pm.response.json();
var moment = require(‘moment’);
pm.test(“x”, function () {
pm.expect(responseJson[0].expirationDate).to.be.above(moment);
});