Chai Test - Broken Tests?

Hello! I have been trying to pass this challenge Run Functional Tests on an API Response using Chai-HTTP IV - PUT method for while, but it is impossible to pass any test. Apparently, there has been a problem with this question before.

My code:

    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);
          assert.equal(res.type, 'application/json');
          assert.equal(res.body.name, 'Giovanni');
          assert.equal(res.body.surname, 'da Verrazzano');
          done();
        });
    });

Any ideas on how can I pass this test?

Thank you

Hello there,

Would you mind sharing a link to your full project code?

Will it work like that?

https://replit.com/@KowalewskiPawel/boilerplate-mochachai#tests/2_functional-tests.js

Thank you.

You cannot comment out a test, as this will break the order the tests are sent as responses.

Hope this helps

I was just trying different solutions while waiting for the answer :wink:

Right, but it is hiding the typo:

// #3
    test('send {surname: "Colombo"}', function (done) {
      chai
        .request(server)
        .put("/travellers")
        .send({surname: "Colombo"})
        .end(function (err, res) {
          assert.equal(res.status, 200);
          assert.equal(res.type, 'application/json');
          assert.equal(res.body.name, 'Cristoforo');
          assert.equal(res.body.surname, 'Colombo');
          done();
        });
    });
  });
});

Check how many closing brackets you have.

1 Like

Thank you, I have already fixed the problem. Now it passes the test in the console, but FCC still doesn’t accept my solution.

When I submit your link, it passes all tests.

1 Like

I have tried many times without any luck, after refreshing the page magically everything started to work. Thank you so much once again, and please close the topic. :man_facepalming:

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