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
26 lines
588 B
JavaScript
26 lines
588 B
JavaScript
// @ts-check
|
|
|
|
import Metrics from '@overleaf/metrics'
|
|
import Settings from '@overleaf/settings'
|
|
import MongoUtils from '@overleaf/mongo-utils'
|
|
import { MongoClient } from 'mongodb'
|
|
|
|
export { ObjectId } from 'mongodb'
|
|
|
|
export const mongoClient = new MongoClient(
|
|
Settings.mongo.url,
|
|
Settings.mongo.options
|
|
)
|
|
const mongoDb = mongoClient.db()
|
|
|
|
export const db = {
|
|
messages: mongoDb.collection('messages'),
|
|
rooms: mongoDb.collection('rooms'),
|
|
}
|
|
|
|
Metrics.mongodb.monitor(mongoClient)
|
|
|
|
export async function cleanupTestDatabase() {
|
|
await MongoUtils.cleanupTestDatabase(mongoClient)
|
|
}
|