[misc] wait for the mongo connection before starting acceptance tests

This commit is contained in:
Jakob Ackermann 2020-08-27 16:28:15 +01:00
parent 84406fd947
commit 1b70189fb1

View file

@ -11,6 +11,7 @@
* DS207: Consider shorter variations of null checks
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
const { waitForDb } = require('../../../../app/js/mongodb')
const app = require('../../../../app')
module.exports = {
@ -25,9 +26,10 @@ module.exports = {
return callback()
} else if (this.initing) {
return this.callbacks.push(callback)
} else {
this.initing = true
this.callbacks.push(callback)
}
this.initing = true
this.callbacks.push(callback)
waitForDb().then(() => {
return app.listen(3010, 'localhost', (error) => {
if (error != null) {
throw error
@ -41,6 +43,6 @@ module.exports = {
return result
})()
})
}
})
}
}