Merge pull request #19416 from overleaf/jpa-test-debug

[web] tests: use named before-all/after-all hooks for mongo setup

GitOrigin-RevId: bbdd0f27d310eac730cec3e2230f177d8112acd8
This commit is contained in:
Jakob Ackermann 2024-07-15 11:21:19 +02:00 committed by Copybot
parent 2d2746ef24
commit a55d9fcf38

View file

@ -10,12 +10,12 @@ const DEFAULT_ENV = 'saas'
module.exports = {
initialize() {
before(waitForDb)
before('wait for db', waitForDb)
if (process.env.CLEANUP_MONGO === 'true') {
before(dropTestDatabase)
before('drop test database', dropTestDatabase)
}
before(function (done) {
before('run migrations', function (done) {
const args = [
'run',
'migrations',
@ -32,7 +32,7 @@ module.exports = {
})
})
afterEach(async function () {
afterEach('purge mongo data', async function () {
return Promise.all(
Object.values(db).map(async collection => {
if (collection === db.migrations) {