overleaf/services/web/test/acceptance/src/Init.js
Jakob Ackermann a096d98956 Merge pull request #3193 from overleaf/jpa-mongodb-native-acceptance-tests
[misc] migrate the acceptance tests to the native mongo driver

GitOrigin-RevId: 5ec8605cafb28cc9cfeb85d7ee0d1b567cfe49ba
2020-10-09 02:05:03 +00:00

24 lines
575 B
JavaScript

const App = require('../../../app.js')
const { exec } = require('child_process')
const { waitForDb, db } = require('../../../app/src/infrastructure/mongodb')
require('logger-sharelatex').logger.level('error')
before(waitForDb)
before(function(done) {
exec('bin/east migrate', (error, stdout, stderr) => {
console.log(stdout)
console.error(stderr)
if (error) {
throw error
}
App.listen(3000, 'localhost', done)
})
})
afterEach(async function() {
return Promise.all(
Object.values(db).map(collection => collection.deleteMany({}))
)
})