Tell us what’s happening:
I can not pass this challenge and here is my code:
// #2
test(‘Test GET /hello with your name’, function(done) {
// Don’t forget the callback…
const name = ‘Mutshinye’;
chai
.request(server) // ‘server’ is the Express App
.get(/hello?name=${name}
)
.end(function(err, res) {
// res is the response object
console.log(res); // Add this line to print out the response object
// Replace assert.fail(). Make the test pass.
// Test the status and the text response. Follow the test order like above.
assert.equal(res.status, 200, 'Expected response status to be 200');
assert.equal(res.text, `hello ${name}`, 'Expected response body to include "hello Mutshinye"');
done(); // Always call the 'done()' callback when finished.
});
});
Your project link(s)
solution: https://chai-test.onrender.com
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36
Challenge: Quality Assurance and Testing with Chai - Run Functional Tests on API Endpoints using Chai-HTTP II
Link to the challenge: