mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
974069bf1c
[misc] joinProject: pass userId and anonymous access token in body 1/2 GitOrigin-RevId: 5d7832246c7262c004c2cd465d62488384b35ee3
42 lines
836 B
JavaScript
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()
|
|
},
|
|
}
|