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
Sky020
April 13, 2021, 8:24am
2
Hello there,
Would you mind sharing a link to your full project code?
Sky020
April 13, 2021, 8:28am
4
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
Sky020
April 13, 2021, 8:32am
6
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.
Sky020
April 13, 2021, 8:37am
8
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.
system
Closed
October 12, 2021, 8:40pm
10
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.