on-internet
← Community

Mocha: Uncaught AssertionError: expected 200 to be 404

Stack Overflow ·

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 How to handle this .. Uncaught AssertionError: expected 200 to be 404 + expected - actual -200 +404 at Assertion.fail (node_

Comments

Sign in or sign up to comment and upvote.

No comments yet.