This is the code I’ve entered for the test
test('send {surname: "da Verrazzano"}', function(done) {
chai.request(server)
.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', 'res.body.name should be "Giovanni"');
assert.equal(res.body.surname, 'da Verrazzano', 'res.body.surname should be "da Verrazzano"');
done();
});
});
And I keep getting the following result:
// running test
expected undefined to equal ‘passed’
Cannot read property ‘0’ of undefined
Cannot read property ‘1’ of undefined
Cannot read property ‘2’ of undefined
Cannot read property ‘3’ of undefined
// tests completed
But this code works for the previous test
test('send {surname: "Colombo"}', function(done){
// we setup the request for you...
chai.request(server)
.put('/travellers')
.send({surname: "Colombo"})
.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, 'Cristoforo', 'res.body.name should be "Cristoforo"');
assert.equal(res.body.surname, 'Colombo', 'res.body.surname should be "Colombo"' );
done();
});
});
What am I missing?