Quality Assurance and Testing with Chai - Run Functional Tests on an API Response using Chai-HTTP IV - PUT method

Tell us what’s happening:
Describe your issue in detail here.

Your project link(s)

solution: boilerplate-mochachai - Replit

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Quality Assurance and Testing with Chai - Run Functional Tests on an API Response using Chai-HTTP IV - PUT method

Link to the challenge:

boilerplate-mochachai - Replit ’ May I know what i do wrong?

       surname: "da Verrazzano",
       name: "Giovanni"

First of all, you do not need to send the name property as that was not asked of you.
Second, you are not sending JSON syntax. You did send a literal object, but you were supposed to send JSON. There is a slight difference. See if you can research what the difference is and make the correct changes to what you send.

I will try to find out. Thank you!

I feel stupid. Can’t get it. Even if the hint doesn’t help. :dotted_line_face:

Does your code reflect your latest changes?

1 Like

I rewrite it like it should be I guess but it still doesn’t work.

Pay close attention to the bullets under A couple of important rules to note:

So my wrongs are on the assert equal part or my chai section?

Can you be more clear please. I practicaly understand that JSON part but I don’t understand what should I do with JSON on this challenge. On challenge 21 I do
approximate same thing and it pass.

You now have the send method part correct now.

However, the following has numerous issues:

          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"' )

Methods are functions and to execute a function, you do not put functionName{. You have the wrong syntax here.

I suggest reviewing this previous challenge which shows the correct use of the end method. It also shows how to check the status and string related responses. Your asserts are not using proper syntax.

Extra Hint: "res.body.name" is just a string. It does not represent the response’s body.name.

Why are you showing this screenshot?

Nothing. Didn’t meant to send it. Sorry

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