added beforeTest to wait for mongoose to be ready

This commit is contained in:
Wyatt Johnson
2018-04-12 08:36:45 -06:00
parent d481dc8651
commit 68473e5a29
+10
View File
@@ -1,5 +1,15 @@
const mongoose = require('../services/mongoose');
beforeAll(function(done) {
mongoose.connection.on('open', function(err) {
if (err) {
return done(err);
}
return done();
});
}, 30000);
beforeEach(async () => {
await Promise.all(
Object.keys(mongoose.connection.collections).map(collection => {