mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Make Mongo available to unit tests in all services GitOrigin-RevId: b65bbb69883d5bba31d09802b89f35bdc523fe4d
27 lines
612 B
JavaScript
27 lines
612 B
JavaScript
// @ts-check
|
|
|
|
const Metrics = require('@overleaf/metrics')
|
|
const MongoUtils = require('@overleaf/mongo-utils')
|
|
const Settings = require('@overleaf/settings')
|
|
const { MongoClient, ObjectId } = require('mongodb-legacy')
|
|
|
|
const mongoClient = new MongoClient(Settings.mongo.url, Settings.mongo.options)
|
|
const mongoDb = mongoClient.db()
|
|
|
|
const db = {
|
|
notifications: mongoDb.collection('notifications'),
|
|
}
|
|
|
|
Metrics.mongodb.monitor(mongoClient)
|
|
|
|
async function cleanupTestDatabase() {
|
|
await MongoUtils.cleanupTestDatabase(mongoClient)
|
|
}
|
|
|
|
module.exports = {
|
|
db,
|
|
mongoClient,
|
|
ObjectId,
|
|
cleanupTestDatabase,
|
|
}
|