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

While this test shows it passes in glitch, I get an error when I run it on FCC. error “running tests
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’
tests completed”

Is anyone else having this issue? Please help.

Your code so far

Your browser information:

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

Challenge: undefined

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

This may be related to open issue #37611

As noted there, the current tests will fail if you use double quotes instead of single quotes (among other purely style decisions you might make).

Thank you, and this is why they said reading is fundamental lol. :hugs:

1 Like

Glad to help!

Really you shouldn’t have to head over to the issue tracker for things like this. The good news is that it’s been identified and will (eventually) get fixed.

My code doesn’t pass the test. Another quotation mark problem ?

Hi @LudwigJedde. Your code looks like it should pass to me . Is it definitely failing the “You should test for ‘res.body.surname’ to be ‘da Verrazzano’” test? Or maybe one of the other ones? Are you able to provide a link to your Glitch project?

1 Like

Hi, Monksy. Here’s the final solution. I was missing two braces and parentheses at the end of the code. Watch out for the “” and the ’ '. Thank you for your answer, monksy.
test 2