Hi there, after stuck on "
Run Functional Tests on API Endpoints using Chai-HTTP" Part1-Part4 in Quality Assurance and Testing with Chai for about 3 hours.
I spotted that the problem I encountered come from the way response JSON from GET request of route ‘/_api/get-tests’ is formatted.
Example
responseObj : {
title: 'send {surname: "Colombo"}',
context:
"Functional Tests -> Integration tests with chai-http -> PUT /travellers",
state: "passed",
assertions: [
{
method: "equal",
args: ["res.status", "200", '"response status should be 200"'],
},
{ method: "equal", args: ["res.type", '"application/json"'] },
{ method: "equal", args: ["res.body.name", '"Cristoforo"'] },
{ method: "equal", args: ["res.body.surname", '"Colombo"'] },
],
}
As you can see from example
responseObj.assertion[1].args[1] is String which value is “application/json” this will not pass the test because it have to specifically be ‘application/json’ to passed.
So I think , in my opinion, both single quote and double quote should be acceptable for use to pass the test.
Sorry if I missed anything of notice that is reason behind this strict rule.
Thanks, Ron
Here is the link to the response JSON from my glitch(The failed one) that I mentioned :
https://coordinated-glorious-period.glitch.me/_api/get-tests?type=functional&n=2