I’m learning API Automation currently in Valentino Artisan Coffee House API
I’m facing this issue of understanding the error in Assignment#1
" Get API status contains status 200 test | AssertionError: The request has no scripts.: expected undefined to be an array"
Please check the below code and try to explain as simple as you can
pm.test("Get API status contains status 200 test", () => {
let request = folder.item.find(req => {return req.name === "Get API status"})
pm.expect(request.event).to.be.an('array', 'The request has no scripts.');
let tests = request.event.find(event => event.listen === 'test');
pm.expect(tests).to.be.an('object', 'The request has no test script.');
pm.expect(tests.script.exec.toString(), 'check script').includes("pm.test");
pm.expect(tests.script.exec.toString(), 'check script').includes("pm.response.to.have.status");
});