I am new to mocha and should.js. I'm trying to check the status of a response, but it gives me a TypeError: Object #<Assertion> has no method 'status' The code looks like this:
describe('Local signup', function() { it('should return error trying to save duplicate username', function(done) { var profile = { email: ' abcd@abcd.com ', password: 'Testing1234', confirmPassword: 'Testing1234', firstName: 'Abc', lastName: 'Defg' }; request(url) .post('/user/signup') .send(profile) .end(function(err, res) { if (err) { throw err; } res.should.have.status(400); done(); }); });
I also noticed that although I declared var should = require('should'); my ide informs me that 'should' is an unused local variable. I really don't know why.
source share