Uhhh.. is this a bug?

Tell us what’s happening:
Please see screenshot below. All tests should pass but the tests below all passed… ?
Is this a bug?
Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.

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

Link to the challenge:
https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-and-testing-with-chai/run-functional-tests-on-an-api-response-using-chai-http-iii---put-method

You have required test cases, but does the tests itself pass?

1 Like

What’s shown in the picture are all the test cases and they have all passed… except ironically the one that says “All tests should pass” lol

I’ve also seen in another thread that this is a known bug issue with Repl.it and this particular challenge? But I’m not sure if this was already resolved

1 Like

I’ve copied and paste the solution from FCC and still won’t work… this is definitely a bug. But i can’t move on to the next lesson without passing this one. So I’m stuck

This is my live link: https://boilerplate-mochachai-1.synerjay.repl.co

1 Like

Hello there,

The test text might be a bit misleading. When it says “all tests should pass” it is not referring to the freeCodeCamp tests you have shown in the screenshot. The tests being referred to are the tests you have written on your app.

Now, would you mind sharing a link to your project code? That way, we can get a better look at what is going on.

1 Like

Ok this is my code for the particular challenge:

 test('send {surname: "Colombo"}', function(done) {
      chai
        .request(server)
        .put("/travellers")

        .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();
        });
    });

If i change the res.body.name to make the test pass, it will fail the other test case for res.body.name on freecodecamp. The link to my repl.it is already posted above.

1 Like

It will really only be possible to ensure we figure out the bug, if we have all of your code to go off of.

1 Like

I already provided the link above.

But if u missed it, it’s here: https://boilerplate-mochachai-1.synerjay.repl.co

1 Like

It would be easier with a link to the code. NOT the live app.

Thanks

1 Like

Not sure if this is it but: https://repl.it/@synerjay/boilerplate-mochachai-1#tests/2_functional-tests.js

1 Like

Thank you.

This is what I did to figure out the issue, so next time, you can do something similar:

  1. Run the app, and look at the assertion output in the Repl.it console:
    image
  • This is referring to this line:
    assert.equal(res.body.name, 'Cristoforo');
  1. Look back at the lesson instructions:

Within tests/2_functional-tests.js , alter the 'send {surname: "Colombo"}' test ( // #3 ):

Send the following JSON response as a payload:

{
  "surname": "Colombo"
}
  1. Look whether this has been done:
test('send {surname: "Colombo"}', function(done) {
      chai
        .request(server)
        .put("/travellers")

        .end(function(err, res) {

Hope this helps
P.S. If you are still confused, look at the previous tests, and compare

3 Likes

Chai HTTP - Chai

1 Like

Ah… thank you!

I confused the test('send {surname: "Colombo"}' as the one that needs altering and the instruction said to “alter” something but actually rather that I needed to “add” something to the code.

Thanks again.

2 Likes

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