mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-11 07:46:34 -05:00
4b308553be
[misc] move the linting setup to the root of the monorepo GitOrigin-RevId: 1633e2a58598add0b727738cd3bfba0ab7bae781
44 lines
1.3 KiB
JavaScript
44 lines
1.3 KiB
JavaScript
/*
|
|
* decaffeinate suggestions:
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
*/
|
|
const chai = require('chai')
|
|
const { expect } = chai
|
|
const path = require('path')
|
|
const modulePath = path.join(__dirname, '../../../event_loop.js')
|
|
const SandboxedModule = require('sandboxed-module')
|
|
const sinon = require('sinon')
|
|
|
|
describe('event_loop', function () {
|
|
before(function () {
|
|
this.metrics = {
|
|
timing: sinon.stub(),
|
|
registerDestructor: sinon.stub(),
|
|
}
|
|
this.logger = {
|
|
warn: sinon.stub(),
|
|
}
|
|
return (this.event_loop = SandboxedModule.require(modulePath, {
|
|
requires: {
|
|
'./index': this.metrics,
|
|
},
|
|
}))
|
|
})
|
|
|
|
describe('with a logger provided', function () {
|
|
before(function () {
|
|
return this.event_loop.monitor(this.logger)
|
|
})
|
|
|
|
return it('should register a destructor with metrics', function () {
|
|
return expect(this.metrics.registerDestructor.called).to.equal(true)
|
|
})
|
|
})
|
|
|
|
return describe('without a logger provided', function () {
|
|
return it('should throw an exception', function () {
|
|
return expect(this.event_loop.monitor).to.throw('logger is undefined')
|
|
})
|
|
})
|
|
})
|