overleaf/services/real-time/test/setup.js
Jakob Ackermann 974069bf1c Merge pull request #16979 from overleaf/jpa-join-project-remove-sl-1
[misc] joinProject: pass userId and anonymous access token in body 1/2

GitOrigin-RevId: 5d7832246c7262c004c2cd465d62488384b35ee3
2024-02-12 09:03:16 +00:00

42 lines
836 B
JavaScript

const chai = require('chai')
const SandboxedModule = require('sandboxed-module')
const sinon = require('sinon')
const chaiAsPromised = require('chai-as-promised')
const sinonChai = require('sinon-chai')
// Chai configuration
chai.should()
chai.use(chaiAsPromised)
chai.use(sinonChai)
// Global stubs
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(),
},
}
// SandboxedModule configuration
SandboxedModule.configure({
requires: {
'@overleaf/logger': stubs.logger,
},
globals: { Buffer, JSON, console, process },
})
// Mocha hooks
exports.mochaHooks = {
beforeEach() {
this.logger = stubs.logger
},
afterEach() {
sandbox.reset()
},
}