Assignment #2 gives error even though I have pm.response.code

Hi,
I am doing the Postman API Test Automation for Beginners by freecodecamp by ‪@vdespa‬ and facing issue on the asignment #2

The ‘Verify your work’ send reques gives pass to all expect on as follows:
orders > Create a new order: contains status code test | AssertionError: check script: expected ‘pm.test(“Status code is 200”, functio…’ to include ‘pm.expect(pm.response.code).to.eql(20…’

However in my orders > Create a new order i have the following codes:
pm.test(“Status code is 200”, function () {
pm.response.to.have.status(200);
pm.expect(pm.response.code).to.eql(200);
});

I also tried the following but got the same message:
pm.test(“Status code is 200”, function () {
pm.expect(pm.response.code).to.eql(200);
});

I would appreciate it if anyone can help.

it was the code that was the issue so it should have been:
pm.test(“Status code is 200 or 201”, function() {
pm.expect(pm.response.code).to.be.oneOf([200, 201]);
});

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.