Tell us what’s happening:
Run Functional Tests on an API Response using Chai-HTTP IV - PUT method
i passed all test except for the one that says i need to pass all test…
###Your project link(s)
solution: https://7cddb199-a610-4178-af48-fc9726531043-00-2d2fad1th6z5n.kirk.replit.dev
my code:
/ #4
test(‘Send {surname: “da Verrazzano”}’, function (done) {
assert.equal(res.status, 200);
assert.equal(res.type, ‘application/json’ );
assert.equal(res.body.name, ‘Giovanni’ );
assert.equal(res.body.surname, ‘da Verrazzano’ );
done();
});
});
});
i also tried with:
// #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);
assert.equal(res.type, ‘application/json’);
assert.equal(res.body.name, ‘Giovanni’);
assert.equal(res.body.surname, ‘da Verrazzano’);
done();
});
});
});
but it not work…
Tests:
-
Failed:1. All tests should pass
-
Passed:2. You should test for
res.statusto be 200 -
Passed:3. You should test for
res.typeto be'application/json' -
Passed:4. You should test for
res.body.nameto be'Giovanni' -
Passed:5. You should test for
res.body.surnameto be'da Verrazzano'
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 OPR/130.0.0.0
Challenge Information:
Quality Assurance and Testing with Chai - Run Functional Tests on an API Response using Chai-HTTP IV - PUT method