Im sending a request(other than the main request) inside pm.test and I return res.code to check if it is 404.
pm.test("Check if child is also deleted", function() {
methods.getEventCategory("api_cec", function(err, res) {
pm.expect(res.code).to.eql(404); // res.code returns the code of getEventCategory
});
});
This code works perfectly. It returns res.code and I can check it. However, if it returns something else, postman still marks it as passed. I think Im doing the assertion wrong. How can I do proper assertion so that if the method returns another code, tests is marked as failed?