Not sure exactly what's happened to my tests, but all of the sudden, I'm getting a timeout from my beforeEach whenever I try to do any sort of Mongoose operation.
var Notification = require('../lib/models').model('Notification');
describe('API Tests', function() {
beforeEach(function(done){
Notification.collection.remove(done);
});
// remainder of tests
});
If I write a test such as:
describe('When performing Mongoose operations', function() {
it('should open a connection' , function(done) {
mongoose.connect(mongooseUri, options);
var conn = mongoose.connection;
conn.on('error', console.error.bind(console, 'connection error'));
conn.once('open', function(callback) {
console.log('connection to MongoDB opened');
});
done();
}
)};
It will pass. My credentials are correct, and other tests that perform Mongoose operations are working as expected, just not in the beforeEach hook. What am I doing wrong?
Aucun commentaire:
Enregistrer un commentaire