overleaf/services/chat/test/acceptance/js/helpers/ChatApp.js
Thomas 4cc888ce2f Merge pull request #6996 from overleaf/tm-expired-project-chat
Add endpoints to chat for deleting expired project chat data

GitOrigin-RevId: e4eb7c7a79472bb116b2095a76c870e204590288
2022-03-17 09:03:41 +00:00

28 lines
542 B
JavaScript

const { db, waitForDb } = require('../../../../app/js/mongodb')
const app = require('../../../../app')
let serverPromise = null
function startServer(resolve, reject) {
waitForDb()
.then(() => {
app.listen(3010, 'localhost', error => {
if (error) {
return reject(error)
}
resolve()
})
})
.catch(reject)
}
async function ensureRunning() {
if (!serverPromise) {
serverPromise = new Promise(startServer)
}
return serverPromise
}
module.exports = {
db,
ensureRunning,
}