mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 10:10:08 +02:00
[filestore] convert to ES modules GitOrigin-RevId: 404905973548bb6e437fff66b368e87be8249b73
38 lines
825 B
JavaScript
38 lines
825 B
JavaScript
import { beforeEach, afterEach, chai, vi } from 'vitest'
|
|
import sinon from 'sinon'
|
|
import mongodb from 'mongodb'
|
|
import sinonChai from 'sinon-chai'
|
|
import chaiAsPromised from 'chai-as-promised'
|
|
|
|
chai.use(sinonChai)
|
|
chai.use(chaiAsPromised)
|
|
|
|
// ensure every ObjectId has the id string as a property for correct comparisons
|
|
mongodb.ObjectId.cacheHexString = true
|
|
|
|
const sandbox = sinon.createSandbox()
|
|
const stubs = {
|
|
logger: {
|
|
debug: sandbox.stub(),
|
|
log: sandbox.stub(),
|
|
info: sandbox.stub(),
|
|
warn: sandbox.stub(),
|
|
err: sandbox.stub(),
|
|
error: sandbox.stub(),
|
|
fatal: sandbox.stub(),
|
|
},
|
|
}
|
|
|
|
beforeEach(ctx => {
|
|
ctx.logger = stubs.logger
|
|
vi.doMock('@overleaf/logger', () => ({
|
|
default: ctx.logger,
|
|
}))
|
|
})
|
|
|
|
afterEach(() => {
|
|
sandbox.reset()
|
|
vi.restoreAllMocks()
|
|
vi.resetModules()
|
|
})
|