Timeout when testing with mocha
I am trying to write a test case using mocha and mongoose. But the following piece of code I wrote gives me a "Todo" error before each "hook: Error: Exceeded 2000ms. Make sure the done () callback is called in this test." I can't iron out the problem. I am a beginner at node. Can someone please help me on this issue. Thanks in advance.
var Todo = require('../models/Todo'),
should = require('Should');
describe('Todo', function(){
beforeEach(function(done){
faketodo = {
name : 'xyz',
completed : true,
note : "This is test note"
}
Todo.remove(done);
});
describe('#save()', function(){
var todo;
beforeEach(function(done){
console.log('before each todo entry');
todo = new Todo(faketodo);
console.log('before each todo exit');
done();
});
it('should have name property', function(done){
todo.save(function(err, todo){
should.not.exist(err);
todo.should.have.property('name', 'xyz');
done();
});
});
it('should not save if name is not present', function(done){
todo.name = '';
todo.save(function(err, todo){
should.exist(err);
should.not.exist(todo.name);
done();
});
});
});
});
+3
source to share