My question: I am trying to validate a POST Response, I get many results and I just want to confirm if the value exists and move on. I suspect this is an often-wanted assertion so I am pretty confident I am making it too hard or flat-out misunderstanding.
Details (like screenshots):
My Response is 2000 lines long and I want to search for a specific ITEM in the response, the ITEM response is an array and I just want it to cycle/loop through the ITEM and find a value:
Error:
Iโve already tried:
I have been trying a variation from another help topic on this forum with no luck but here is my assertion:
var CourseId1 = pm.globals.get(โgCourseId1โ);
let jsonData = pm.response.json();
pm.test("Verify Course was added to requiredCourseDetailList from courseCategoryDetailList1: " + CourseId1, () => {
let requiredCourseId = _.values(jsonData[โpayloadโ].data.requiredCourseDetailList);
console.log(requiredCourseId);
_.each(requiredCourseId, (item) => {pm.expect(item.requiredCourseId).to.equal(CourseId1);
});
});