From 68473e5a29cd88c4efd097d49bfc3a1f09a4f696 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 12 Apr 2018 08:36:45 -0600 Subject: [PATCH] added beforeTest to wait for mongoose to be ready --- test/setupJest.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/setupJest.js b/test/setupJest.js index 9ff2d8af4..6ed78a9c5 100644 --- a/test/setupJest.js +++ b/test/setupJest.js @@ -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 => {