Quality Assurance and Testing with Chai - Run Functional Tests on an API Response using Chai-HTTP IV - PUT method

I can’t pass test #21 of the first part of the QA course.

I consider that I already used the solution that the page gives but I can’t get through.

Could someone help me understand what happens and solve the exercise if it is not correct to pass the test?

My response to this exercise is:

// #4
test(‘send {surname: “da Verrazzano”}’, function(done) {
chai
.request(server)
.keepOpen()
.put(‘/travellers’)
.send({ surname: ‘da Verrazzano’ })
.end(function(err, res) {
assert.equal(res.status, 200, ‘response status should be 200’);
assert.equal(res.type, ‘application/json’, ‘Response should be json’);
assert.equal(res.body.name, ‘Giovanni’);
assert.equal(res.body.surname, ‘da Verrazzano’);
done();
});
});

Thank you!

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36

Challenge: Quality Assurance and Testing with Chai - Run Functional Tests on an API Response using Chai-HTTP IV - PUT method

Link to the challenge:

Solution to exercise:

// #4
test(‘send {surname: “da Verrazzano”}’, function(done) {
chai
.request(server)
.keepOpen()
.put(‘/travellers’)
.send({ surname: ‘da Verrazzano’ })
.end(function(err, res) {
assert.equal(res.status, 200, ‘response status should be 200’);
assert.equal(res.type, ‘application/json’, ‘Response should be json’);
assert.equal(res.body.name, ‘Giovanni’);
assert.equal(res.body.surname, ‘da Verrazzano’);
done();
});
});
});
});

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