mirror of
https://github.com/wassname/talk.git
synced 2026-07-10 20:20:02 +08:00
added beforeTest to wait for mongoose to be ready
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user