What
Not passing the challenge
Link to Challenge
Quality Assurance and Testing with Chai - Run Functional Tests on API Endpoints using Chai-HTTP II
Code
test('Test GET /hello with your name', function(done){ // Don't forget the callback...
chai.request(server) // 'server' is the Express App
.get('/hello?name=Rohit') /** <=== Put your name in the query **/
.end(function(err, res){ // res is the response object
// Your tests here.
// 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);
assert.equal(res.text, 'hello Rohit'/** <== Put your name here **/);
done(); // Always call the 'done()' callback when finished.
});
});
Error received
// running test
expected undefined to equal 'passed'
Cannot read property '0' of undefined
Cannot read property '1' of undefined
// tests completed