mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Global test setup
Configure chai and SandboxedModule globally with options used in many tests. That required upgrading mocha and SandboxedModule.
This commit is contained in:
@@ -13,8 +13,6 @@
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const sinon = require('sinon')
|
||||
const chai = require('chai')
|
||||
const should = chai.should()
|
||||
const modulePath = '../../../../app/js/ProjectManager.js'
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
|
||||
@@ -26,10 +24,6 @@ describe('ProjectManager - flushAndDeleteProject', function () {
|
||||
'./RedisManager': (this.RedisManager = {}),
|
||||
'./ProjectHistoryRedisManager': (this.ProjectHistoryRedisManager = {}),
|
||||
'./DocumentManager': (this.DocumentManager = {}),
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
error: sinon.stub()
|
||||
}),
|
||||
'./HistoryManager': (this.HistoryManager = {
|
||||
flushProjectChanges: sinon.stub().callsArg(2)
|
||||
}),
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const sinon = require('sinon')
|
||||
const chai = require('chai')
|
||||
const should = chai.should()
|
||||
const modulePath = '../../../../app/js/ProjectManager.js'
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
|
||||
@@ -28,10 +26,6 @@ describe('ProjectManager - flushProject', function () {
|
||||
'./RedisManager': (this.RedisManager = {}),
|
||||
'./ProjectHistoryRedisManager': (this.ProjectHistoryRedisManager = {}),
|
||||
'./DocumentManager': (this.DocumentManager = {}),
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
error: sinon.stub()
|
||||
}),
|
||||
'./HistoryManager': (this.HistoryManager = {}),
|
||||
'./Metrics': (this.Metrics = {
|
||||
Timer: (Timer = (function () {
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
const sinon = require('sinon')
|
||||
const chai = require('chai')
|
||||
const should = chai.should()
|
||||
const modulePath = '../../../../app/js/ProjectManager.js'
|
||||
const SandboxedModule = require('sandboxed-module')
|
||||
const Errors = require('../../../../app/js/Errors.js')
|
||||
@@ -25,10 +23,6 @@ describe('ProjectManager - getProjectDocsAndFlushIfOld', function () {
|
||||
'./RedisManager': (this.RedisManager = {}),
|
||||
'./ProjectHistoryRedisManager': (this.ProjectHistoryRedisManager = {}),
|
||||
'./DocumentManager': (this.DocumentManager = {}),
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
error: sinon.stub()
|
||||
}),
|
||||
'./HistoryManager': (this.HistoryManager = {}),
|
||||
'./Metrics': (this.Metrics = {
|
||||
Timer: (Timer = (function () {
|
||||
|
||||
@@ -22,17 +22,11 @@ describe('ProjectManager', function () {
|
||||
}
|
||||
this.Metrics.Timer.prototype.done = sinon.stub()
|
||||
|
||||
this.logger = {
|
||||
log: sinon.stub(),
|
||||
error: sinon.stub()
|
||||
}
|
||||
|
||||
this.ProjectManager = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'./RedisManager': this.RedisManager,
|
||||
'./ProjectHistoryRedisManager': this.ProjectHistoryRedisManager,
|
||||
'./DocumentManager': this.DocumentManager,
|
||||
'logger-sharelatex': this.logger,
|
||||
'./HistoryManager': this.HistoryManager,
|
||||
'./Metrics': this.Metrics
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user