Tell us what’s happening:
The code isn’t working for this challenge even when I use the solution from the hints.
Your code so far
/* I cannot get this to work think something is wrong on the site because this is the answer from the hint */
test('send {surname: "da Verrazzano"}', function(done) {
chai
.request(server)
.put('/travellers')
.send({ surname: 'da Verrazzano' })
/** place your tests inside the callback **/
.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();
});
});
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36
.
Challenge: undefined
Link to the challenge:
https://www.freecodecamp.org/learn/information-security-and-quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iv---put-method