I am trying to test random urr. Which doesn't exits. So response code should 404 but it is returning 200, Which makes test case fail, Till here fine But it is giving Uncaught AssertionError: expected 200 to be 404
How to handle this uncaught Assertion error.
it("Should return 404 when you put random url after /api/random", function(done){
server
.post("/api/random")
.expect(404)
.end(function(err, res){
res.status.should.equal(404);
done();
})
});
Uncaught AssertionError
Uncaught AssertionError: expected 200 to be 404
+ expected - actual
-200
+404
at Assertion.fail (node_modules/should/lib/assertion.js:180:17)
at Assertion.prop.value (node_modules/should/lib/assertion.js:65:17)
at Test.<anonymous> (test.js:48:33)
at Test.assert (node_modules/supertest/lib/test.js:156:6)
at assert (node_modules/supertest/lib/test.js:127:12)
at node_modules/supertest/lib/test.js:124:5
at Test.Request.callback (node_modules/supertest/node_modules/superagent/lib/node/index.js:785:12)
at IncomingMessage.<anonymous> (node_modules/supertest/node_modules/superagent/lib/node/index.js:990:12)
at _stream_readable.js:920:16
Aucun commentaire:
Enregistrer un commentaire