Saturday 30 September 2017

Mocha testing problem

Help me out, I have a test that seems to return an error but, the condition for the test passes. What am I missing?it('Should not be able to login if not registered', function(done) { chai.request('localhost:3000') .post('/login') .type('form') .send({ username: "wrongusername", password: "wrongpassword" }) .end(function(err, res) { if (err) return done(err); // Seems to error here? res.status.should.be.equal(401); // status is 401 done(); }); }); Here is the error shown in the console:1) Auth Test: Should not be able to login if not registered: Error: Unauthorized

Submitted October 01, 2017 at 04:12AM by soggybag

No comments:

Post a Comment