Tests/2_functional-tests.js, test (// #4

Tell us what’s happening:
Describe your issue in detail here.
I can´t pass this test even copying the answer from the hint/solution. Always says the same:

  • You should test for res.status to be 200

  • You should test for res.type to be 'application/json'

  • You should test for res.body.name to be 'Giovanni'

  • You should test for res.body.surname to be 'da Verrazzano'
    this is the code:
    test(‘send {surname: “da Verrazzano”}’, function(done) {
    /** place the chai-http request code here… /
    .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’);


Your project link(s)

solution: boilerplate-mochachai-1 - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.109 Safari/537.36 OPR/84.0.4316.42

Challenge: Run Functional Tests on an API Response using Chai-HTTP IV - PUT method

Link to the challenge:

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