My question:
I want to check if response at specific location contains any word from the list. If YES return an id of that document (or console.log id)
Here it is
https://www.postman.com/nonikoff/workspace/rabota-ua/overview
body contains array of “documents”: []
each document contains “experience”: []
I’m traying to check if experience contains some string at company
For this I have a Test
pm.test(“Check if responce at documents[i].experience[k].company contains one of the next words”, function() {
var response = pm.response.json();
for (let i = 0; i < response.documents.length; i++) {
for (let k = 0; k < response.documents[i].experience.length; k++) {
pm.expect(response.documents[i].experience[k].company.toLowerCase()).to.satisfy(function(item) {
console.log(response.documents[i].url, (item.indexOf("поліція") > -1) || (item.indexOf("эпицентр") > -1));
return(item.indexOf("поліція") > -1) || (item.indexOf("эпицентр") > -1);
});
}
}
});
but it checks first 3 documents from 5
Thanks in advance