Hello everybody!
Please help with writing a script for validating the response in the body of the json message (an example of json below).
So far, such a test returns an error:
pm.test ("Appeals with the status 'Withdrawn' come in the list v2", function () {
var jsonData = pm.response.json ();
pm.expect (jsonData.body.appeals.appeal) .to.have.property ("id");
})
I want to check that the list contains the entity with the status “Withdrawn”
Example json:
{
"success":true,
"body":{
"lastPage":true,
"appeals":[
{
"appeal":{
"id":"1-SKZND7K",
"num":"200416-0098-219500",
"createDate":"2020-04-15T21:23:57.000Z",
"clientDate":"2020-04-20T13:24:52.000Z",
"status":"В работе",
"subjects":[
"Тематика для клиента - Тест",
"Тематика для клиента - Тест 2"
]
}
},
{
"appeal":{
"id":"1-SKYEU04",
"num":"200416-0098-218900",
"createDate":"2020-04-15T21:15:55.000Z",
"clientDate":"2020-04-20T13:17:07.000Z",
"status":"В работе",
"subjects":[
"Тематика для клиента - Тест",
"Тематика для клиента - Тест 2"
]
}
},
{
"appeal":{
"id":"1-SKYBBK0",
"num":"200415-0098-209100",
"createDate":"2020-04-15T20:55:45.000Z",
"clientDate":"2020-04-20T12:57:21.000Z",
"status":"В работе",
"subjects":[
"Тематика для клиента - Тест",
"Тематика для клиента - Тест 2"
]
}
}
]
}
}