Merge pull request #29841 from overleaf/ar-convert-filestore-to-esm

[filestore] convert to ES modules

GitOrigin-RevId: 404905973548bb6e437fff66b368e87be8249b73
This commit is contained in:
Andrew Rumble
2025-12-04 13:45:03 +00:00
committed by Copybot
parent 3f6e96f58e
commit 90cf4b6a0a
39 changed files with 1001 additions and 905 deletions

View File

@@ -0,0 +1,37 @@
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()
})