mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #1937 from overleaf/spd-sandboxedmodule-global-console
Add 'console' to SandboxedModule globals GitOrigin-RevId: fad442ca128561a4fa193b929f217cf31ad0f043
This commit is contained in:
parent
9cc5dc968c
commit
238e2b2565
142 changed files with 453 additions and 0 deletions
|
@ -20,6 +20,9 @@ describe('AnalyticsController', function() {
|
|||
}
|
||||
|
||||
this.controller = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./AnalyticsManager': this.AnalyticsManager,
|
||||
'../Authentication/AuthenticationController': this
|
||||
|
|
|
@ -18,6 +18,9 @@ describe('AnalyticsManager', function() {
|
|||
this.backgroundRequest = sinon.stub().yields()
|
||||
this.request = sinon.stub().yields()
|
||||
this.AnalyticsManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'../../infrastructure/FaultTolerantRequest': {
|
||||
|
|
|
@ -32,6 +32,9 @@ describe('AnnouncementsHandler', function() {
|
|||
this.BlogHandler = { getLatestAnnouncements: sinon.stub() }
|
||||
this.settings = {}
|
||||
return (this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Analytics/AnalyticsManager': this.AnalyticsManager,
|
||||
'../Blog/BlogHandler': this.BlogHandler,
|
||||
|
|
|
@ -30,6 +30,9 @@ describe('AuthenticationController', function() {
|
|||
tk.freeze(Date.now())
|
||||
this.UserModel = { findOne: sinon.stub() }
|
||||
this.AuthenticationController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./AuthenticationManager': (this.AuthenticationManager = {}),
|
||||
'../User/UserUpdater': (this.UserUpdater = {
|
||||
|
|
|
@ -27,6 +27,9 @@ describe('AuthenticationManager', function() {
|
|||
beforeEach(function() {
|
||||
this.settings = { security: { bcryptRounds: 12 } }
|
||||
this.AuthenticationManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/User': {
|
||||
User: (this.User = {})
|
||||
|
|
|
@ -23,6 +23,9 @@ const Errors = require('../../../../app/src/Features/Errors/Errors.js')
|
|||
describe('AuthorizationManager', function() {
|
||||
beforeEach(function() {
|
||||
this.AuthorizationManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Collaborators/CollaboratorsHandler': (this.CollaboratorsHandler = {}),
|
||||
'../Project/ProjectGetter': (this.ProjectGetter = {}),
|
||||
|
|
|
@ -30,6 +30,9 @@ describe('AuthorizationMiddleware', function() {
|
|||
isUserLoggedIn: sinon.stub().returns(true)
|
||||
}
|
||||
this.AuthorizationMiddleware = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./AuthorizationManager': (this.AuthorizationManager = {}),
|
||||
'logger-sharelatex': { log() {} },
|
||||
|
|
|
@ -37,6 +37,9 @@ describe('BetaProgramController', function() {
|
|||
}
|
||||
}
|
||||
this.BetaProgramController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./BetaProgramHandler': (this.BetaProgramHandler = {
|
||||
optIn: sinon.stub(),
|
||||
|
|
|
@ -33,6 +33,9 @@ describe('BetaProgramHandler', function() {
|
|||
save: sinon.stub().callsArgWith(0, null)
|
||||
}
|
||||
return (this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/User': {
|
||||
User: {
|
||||
|
|
|
@ -33,6 +33,9 @@ describe('BlogController', function() {
|
|||
this.request = { get: sinon.stub() }
|
||||
this.ErrorController = {}
|
||||
this.BlogController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -38,6 +38,9 @@ describe('BrandVariationsHandler', function() {
|
|||
}
|
||||
this.V1Api = { request: sinon.stub() }
|
||||
this.BrandVariationsHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': this.logger,
|
||||
|
|
|
@ -32,6 +32,9 @@ describe('ChatApiHandler', function() {
|
|||
}
|
||||
this.request = sinon.stub()
|
||||
this.ChatApiHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -33,6 +33,9 @@ describe('ChatController', function() {
|
|||
getLoggedInUserId: sinon.stub().returns(this.user_id)
|
||||
}
|
||||
this.ChatController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -25,6 +25,9 @@ const { ObjectId } = require('mongojs')
|
|||
describe('CollaboratorsController', function() {
|
||||
beforeEach(function() {
|
||||
this.CollaboratorsController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./CollaboratorsHandler': (this.CollaboratorsHandler = {}),
|
||||
'../Editor/EditorRealTimeController': (this.EditorRealTimeController = {}),
|
||||
|
|
|
@ -29,6 +29,9 @@ const { ObjectId } = require('mongojs')
|
|||
describe('CollaboratorsHandler', function() {
|
||||
beforeEach(function() {
|
||||
this.CollaboratorHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
|
|
|
@ -44,6 +44,9 @@ describe('CollaboratorsInviteController', function() {
|
|||
}
|
||||
|
||||
this.CollaboratorsInviteController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Project/ProjectGetter': (this.ProjectGetter = {}),
|
||||
'../Subscription/LimitationsManager': this.LimitationsManager,
|
||||
|
|
|
@ -54,6 +54,9 @@ describe('CollaboratorsInviteHandler', function() {
|
|||
})()
|
||||
this.Crypto = Crypto
|
||||
this.CollaboratorsInviteHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': (this.settings = {}),
|
||||
'../../models/ProjectInvite': { ProjectInvite: this.ProjectInvite },
|
||||
|
|
|
@ -70,6 +70,9 @@ describe('ClsiCookieManager', function() {
|
|||
})
|
||||
}
|
||||
return (this.ClsiCookieManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: this.requires
|
||||
})())
|
||||
})
|
||||
|
@ -196,6 +199,9 @@ describe('ClsiCookieManager', function() {
|
|||
it('should not set the server id if clsiCookies are not enabled', function(done) {
|
||||
delete this.settings.clsiCookie.key
|
||||
this.ClsiCookieManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: this.requires
|
||||
})()
|
||||
return this.ClsiCookieManager.setServerId(
|
||||
|
@ -236,6 +242,9 @@ describe('ClsiCookieManager', function() {
|
|||
.withArgs('clsi_cookie_secondary')
|
||||
.returns(this.redis_secondary)
|
||||
this.ClsiCookieManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: this.requires
|
||||
})()
|
||||
this.ClsiCookieManager._parseServerIdFromResponse = sinon
|
||||
|
@ -285,6 +294,9 @@ describe('ClsiCookieManager', function() {
|
|||
it('should return empty cookie jar if clsiCookies are not enabled', function(done) {
|
||||
delete this.settings.clsiCookie.key
|
||||
this.ClsiCookieManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: this.requires
|
||||
})()
|
||||
return this.ClsiCookieManager.getCookieJar(this.project_id, function(
|
||||
|
|
|
@ -21,6 +21,9 @@ const SandboxedModule = require('sandboxed-module')
|
|||
describe('ClsiFormatChecker', function() {
|
||||
beforeEach(function() {
|
||||
this.ClsiFormatChecker = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': (this.settings = { compileBodySizeLimitMb: 5 }),
|
||||
'logger-sharelatex': (this.logger = {
|
||||
|
|
|
@ -35,6 +35,9 @@ describe('ClsiManager', function() {
|
|||
checkRecoursesForProblems: sinon.stub().callsArgWith(1)
|
||||
}
|
||||
this.ClsiManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': (this.settings = {
|
||||
apis: {
|
||||
|
|
|
@ -22,6 +22,9 @@ const SandboxedModule = require('sandboxed-module')
|
|||
describe('ClsiStateManager', function() {
|
||||
beforeEach(function() {
|
||||
this.ClsiStateManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': (this.settings = {}),
|
||||
'../Project/ProjectEntityHandler': (this.ProjectEntityHandler = {}),
|
||||
|
|
|
@ -61,6 +61,9 @@ describe('CompileController', function() {
|
|||
isUserLoggedIn: sinon.stub().returns(true)
|
||||
}
|
||||
this.CompileController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
request: (this.request = sinon.stub()),
|
||||
|
|
|
@ -27,6 +27,9 @@ describe('CompileManager', function() {
|
|||
const { rateLimitGetStub } = this
|
||||
this.ratelimiter = { addCount: sinon.stub() }
|
||||
this.CompileManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': (this.settings = {
|
||||
redis: { web: { host: 'localhost', port: 42 } }
|
||||
|
|
|
@ -23,6 +23,9 @@ describe('ContactController', function() {
|
|||
beforeEach(function() {
|
||||
this.AuthenticationController = { getLoggedInUserId: sinon.stub() }
|
||||
this.ContactController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
|
|
|
@ -18,6 +18,9 @@ const SandboxedModule = require('sandboxed-module')
|
|||
describe('ContactManager', function() {
|
||||
beforeEach(function() {
|
||||
this.ContactManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
request: (this.request = sinon.stub()),
|
||||
'settings-sharelatex': (this.settings = {
|
||||
|
|
|
@ -25,6 +25,9 @@ describe('CooldownManager', function() {
|
|||
this.rclient = { set: sinon.stub(), get: sinon.stub() }
|
||||
this.RedisWrapper = { client: () => this.rclient }
|
||||
return (this.CooldownManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../infrastructure/RedisWrapper': this.RedisWrapper,
|
||||
'logger-sharelatex': { log: sinon.stub() }
|
||||
|
|
|
@ -22,6 +22,9 @@ describe('CooldownMiddleware', function() {
|
|||
beforeEach(function() {
|
||||
this.CooldownManager = { isProjectOnCooldown: sinon.stub() }
|
||||
return (this.CooldownMiddleware = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./CooldownManager': this.CooldownManager,
|
||||
'logger-sharelatex': { log: sinon.stub() }
|
||||
|
|
|
@ -20,6 +20,9 @@ describe('DocstoreManager', function() {
|
|||
beforeEach(function() {
|
||||
this.requestDefaults = sinon.stub().returns((this.request = sinon.stub()))
|
||||
this.DocstoreManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
request: {
|
||||
defaults: this.requestDefaults
|
||||
|
|
|
@ -49,6 +49,9 @@ describe('DocumentUpdaterHandler', function() {
|
|||
|
||||
this.callback = sinon.stub()
|
||||
return (this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
request: {
|
||||
defaults: () => {
|
||||
|
|
|
@ -25,6 +25,9 @@ const Errors = require('../../../../app/src/Features/Errors/Errors')
|
|||
describe('DocumentController', function() {
|
||||
beforeEach(function() {
|
||||
this.DocumentController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log() {},
|
||||
|
|
|
@ -30,6 +30,9 @@ describe('ProjectDownloadsController', function() {
|
|||
return (this.ProjectDownloadsController = SandboxedModule.require(
|
||||
modulePath,
|
||||
{
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./ProjectZipStreamManager': (this.ProjectZipStreamManager = {}),
|
||||
'../Project/ProjectGetter': (this.ProjectGetter = {}),
|
||||
|
|
|
@ -33,6 +33,9 @@ describe('ProjectZipStreamManager', function() {
|
|||
append: sinon.stub()
|
||||
}
|
||||
return (this.ProjectZipStreamManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
archiver: (this.archiver = sinon.stub().returns(this.archive)),
|
||||
'logger-sharelatex': (this.logger = {
|
||||
|
|
|
@ -45,6 +45,9 @@ describe('EditorController', function() {
|
|||
this.callback = sinon.stub()
|
||||
|
||||
return (this.EditorController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Project/ProjectEntityUpdateHandler': (this.ProjectEntityUpdateHandler = {}),
|
||||
'../Project/ProjectOptionsHandler': (this.ProjectOptionsHandler = {
|
||||
|
|
|
@ -21,6 +21,9 @@ const Errors = require('../../../../app/src/Features/Errors/Errors')
|
|||
describe('EditorHttpController', function() {
|
||||
beforeEach(function() {
|
||||
this.EditorHttpController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Project/ProjectEntityUpdateHandler': (this.ProjectEntityUpdateHandler = {}),
|
||||
'../Project/ProjectDeleter': (this.ProjectDeleter = {}),
|
||||
|
|
|
@ -22,6 +22,9 @@ describe('EditorRealTimeController', function() {
|
|||
beforeEach(function() {
|
||||
this.rclient = { publish: sinon.stub() }
|
||||
this.EditorRealTimeController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../infrastructure/RedisWrapper': {
|
||||
client: () => this.rclient
|
||||
|
|
|
@ -31,6 +31,9 @@ describe('EmailBuilder', function() {
|
|||
brandPrefix: ''
|
||||
}
|
||||
return (this.EmailBuilder = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -27,6 +27,9 @@ describe('EmailHandler', function() {
|
|||
this.EmailBuilder = { buildEmail: sinon.stub() }
|
||||
this.EmailSender = { sendEmail: sinon.stub() }
|
||||
this.EmailHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./EmailBuilder': this.EmailBuilder,
|
||||
'./EmailSender': this.EmailSender,
|
||||
|
|
|
@ -42,6 +42,9 @@ describe('EmailSender', function() {
|
|||
this.ses = { createTransport: () => this.sesClient }
|
||||
|
||||
this.sender = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
nodemailer: this.ses,
|
||||
'nodemailer-mandrill-transport': {},
|
||||
|
|
|
@ -64,6 +64,9 @@ describe('ExportsController', function() {
|
|||
getLoggedInUserId: sinon.stub().returns(this.req.session.user._id)
|
||||
}
|
||||
return (this.controller = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./ExportsHandler': this.handler,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -27,6 +27,9 @@ describe('ExportsHandler', function() {
|
|||
}
|
||||
}
|
||||
this.ExportsHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log() {},
|
||||
|
|
|
@ -14,6 +14,9 @@ describe('FileStoreController', function() {
|
|||
this.ProjectLocator = { findElement: sinon.stub() }
|
||||
this.Errors = { NotFoundError: sinon.stub() }
|
||||
this.controller = SandboxedModule.require(MODULE_PATH, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': (this.logger = {
|
||||
|
|
|
@ -63,6 +63,9 @@ describe('FileStoreHandler', function() {
|
|||
computeHash: sinon.stub().callsArgWith(1, null, this.hashValue)
|
||||
}
|
||||
this.handler = SandboxedModule.require(MODULE_PATH, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
request: this.request,
|
||||
|
|
|
@ -26,6 +26,9 @@ describe('HistoryController', function() {
|
|||
getLoggedInUserId: sinon.stub().returns(this.user_id)
|
||||
}
|
||||
this.HistoryController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
request: (this.request = sinon.stub()),
|
||||
'settings-sharelatex': (this.settings = {}),
|
||||
|
|
|
@ -24,6 +24,9 @@ describe('HistoryManager', function() {
|
|||
getLoggedInUserId: sinon.stub().returns(this.user_id)
|
||||
}
|
||||
this.HistoryManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
request: (this.request = sinon.stub()),
|
||||
'settings-sharelatex': (this.settings = {}),
|
||||
|
|
|
@ -27,6 +27,9 @@ describe('RestoreManager', function() {
|
|||
beforeEach(function() {
|
||||
tk.freeze(Date.now()) // freeze the time for these tests
|
||||
this.RestoreManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../infrastructure/FileWriter': (this.FileWriter = {}),
|
||||
'../Uploads/FileSystemImportManager': (this.FileSystemImportManager = {}),
|
||||
|
|
|
@ -36,6 +36,9 @@ describe('InactiveProjectManager', function() {
|
|||
this.ProjectGetter = { getProject: sinon.stub() }
|
||||
this.TrackChangesManager = { archiveProject: sinon.stub() }
|
||||
this.InactiveProjectManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -31,6 +31,9 @@ describe('InstitutionsAPI', function() {
|
|||
read: (this.markAsReadIpMatcher = sinon.stub().callsArgWith(1, null))
|
||||
}
|
||||
this.InstitutionsAPI = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': this.logger,
|
||||
'metrics-sharelatex': {
|
||||
|
|
|
@ -51,6 +51,9 @@ describe('InstitutionsController', function() {
|
|||
this.addAffiliation = sinon.stub().callsArgWith(3, null)
|
||||
this.refreshFeatures = sinon.stub().yields(null)
|
||||
this.InstitutionsController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': this.logger,
|
||||
'../User/UserGetter': {
|
||||
|
|
|
@ -26,6 +26,9 @@ describe('InstitutionsFeatures', function() {
|
|||
this.PlansLocator = { findLocalPlanInSettings: sinon.stub() }
|
||||
this.institutionPlanCode = 'institution_plan_code'
|
||||
this.InstitutionsFeatures = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./InstitutionsGetter': this.InstitutionsGetter,
|
||||
'../Subscription/PlansLocator': this.PlansLocator,
|
||||
|
|
|
@ -22,6 +22,9 @@ describe('InstitutionsGetter', function() {
|
|||
beforeEach(function() {
|
||||
this.UserGetter = { getUserFullEmails: sinon.stub() }
|
||||
this.InstitutionsGetter = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../User/UserGetter': this.UserGetter,
|
||||
'../UserMembership/UserMembershipsHandler': (this.UserMembershipsHandler = {}),
|
||||
|
|
|
@ -64,6 +64,9 @@ describe('InstitutionsManager', function() {
|
|||
this.Mongo = { ObjectId: sinon.stub().returnsArg(0) }
|
||||
|
||||
return (this.InstitutionsManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': this.logger,
|
||||
'./InstitutionsAPI': {
|
||||
|
|
|
@ -27,6 +27,9 @@ describe('MetaController', function() {
|
|||
getMetaForDoc: sinon.stub()
|
||||
}
|
||||
return (this.MetadataController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log: sinon.stub(),
|
||||
|
|
|
@ -54,6 +54,9 @@ describe('MetaHandler', function() {
|
|||
}
|
||||
|
||||
return (this.MetaHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Project/ProjectEntityHandler': this.ProjectEntityHandler,
|
||||
'../DocumentUpdater/DocumentUpdaterHandler': this
|
||||
|
|
|
@ -34,6 +34,9 @@ describe('NotificationsBuilder', function() {
|
|||
.returns(this.stubResponse)
|
||||
.callsArgWith(1, null, response, this.body)
|
||||
return (this.controller = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./NotificationsHandler': this.handler,
|
||||
'settings-sharelatex': this.settings,
|
||||
|
|
|
@ -46,6 +46,9 @@ describe('NotificationsController', function() {
|
|||
getLoggedInUserId: sinon.stub().returns(this.req.session.user._id)
|
||||
}
|
||||
return (this.controller = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./NotificationsHandler': this.handler,
|
||||
underscore: (this.underscore = {
|
||||
|
|
|
@ -30,6 +30,9 @@ describe('NotificationsHandler', function() {
|
|||
beforeEach(function() {
|
||||
this.request = sinon.stub().callsArgWith(1)
|
||||
return (this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': {
|
||||
apis: { notifications: { url: notificationUrl } }
|
||||
|
|
|
@ -39,6 +39,9 @@ describe('PasswordResetController', function() {
|
|||
removeReconfirmFlag: sinon.stub().callsArgWith(1, null)
|
||||
}
|
||||
this.PasswordResetController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'./PasswordResetHandler': this.PasswordResetHandler,
|
||||
|
|
|
@ -27,6 +27,9 @@ describe('PasswordResetHandler', function() {
|
|||
}
|
||||
this.V1Api = { request: sinon.stub() }
|
||||
this.PasswordResetHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../User/UserGetter': this.UserGetter,
|
||||
'../Security/OneTimeTokenHandler': this.OneTimeTokenHandler,
|
||||
|
|
|
@ -20,6 +20,9 @@ const SandboxedModule = require('sandboxed-module')
|
|||
describe('doc lines comparitor', function() {
|
||||
beforeEach(function() {
|
||||
return (this.comparitor = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': { log() {} }
|
||||
}
|
||||
|
|
|
@ -20,6 +20,9 @@ describe('Project api controller', function() {
|
|||
beforeEach(function() {
|
||||
this.ProjectDetailsHandler = { getDetails: sinon.stub() }
|
||||
this.controller = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./ProjectDetailsHandler': this.ProjectDetailsHandler,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -34,6 +34,9 @@ describe('ProjectCollabratecDetailsHandler', function() {
|
|||
this.ProjectCollabratecDetailsHandler = SandboxedModule.require(
|
||||
modulePath,
|
||||
{
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/Project': { Project: this.ProjectModel }
|
||||
}
|
||||
|
|
|
@ -116,6 +116,9 @@ describe('ProjectController', function() {
|
|||
this.getUserAffiliations = sinon.stub().callsArgWith(1, null, [])
|
||||
|
||||
this.ProjectController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -89,6 +89,9 @@ describe('ProjectCreationHandler', function() {
|
|||
this.AnalyticsManager = { recordEvent: sinon.stub() }
|
||||
|
||||
return (this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/User': {
|
||||
User: this.User
|
||||
|
|
|
@ -72,6 +72,9 @@ describe('ProjectDeleter', function() {
|
|||
.yields(null, ['member-id-1', 'member-id-2'])
|
||||
}
|
||||
return (this.deleter = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Editor/EditorController': this.editorController,
|
||||
'../../models/Project': { Project: this.Project },
|
||||
|
|
|
@ -52,6 +52,9 @@ describe('ProjectDetailsHandler', function() {
|
|||
removeUserFromProject: sinon.stub().callsArg(2)
|
||||
}
|
||||
return (this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./ProjectGetter': this.ProjectGetter,
|
||||
'../../models/Project': {
|
||||
|
|
|
@ -148,6 +148,9 @@ describe('ProjectDuplicator', function() {
|
|||
this.ProjectDeleter = { deleteProject: sinon.stub().callsArgWith(1, null) }
|
||||
|
||||
return (this.duplicator = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/Project': { Project: this.Project },
|
||||
'../DocumentUpdater/DocumentUpdaterHandler': this
|
||||
|
|
|
@ -61,6 +61,9 @@ describe('ProjectEntityHandler', function() {
|
|||
this.callback = sinon.stub()
|
||||
|
||||
return (this.ProjectEntityHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
|
|
|
@ -48,6 +48,9 @@ describe('ProjectEntityMongoUpdateHandler', function() {
|
|||
|
||||
tk.freeze(Date.now())
|
||||
return (this.subject = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
|
|
|
@ -85,6 +85,9 @@ describe('ProjectEntityUpdateHandler', function() {
|
|||
return (this.ProjectEntityUpdateHandler = SandboxedModule.require(
|
||||
modulePath,
|
||||
{
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
|
|
|
@ -24,6 +24,9 @@ describe('ProjectGetter', function() {
|
|||
beforeEach(function() {
|
||||
this.callback = sinon.stub()
|
||||
return (this.ProjectGetter = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../infrastructure/mongojs': {
|
||||
db: (this.db = {
|
||||
|
|
|
@ -46,6 +46,9 @@ describe('ProjectHistoryHandler', function() {
|
|||
this.callback = sinon.stub()
|
||||
|
||||
return (this.ProjectHistoryHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
|
|
|
@ -66,6 +66,9 @@ describe('ProjectLocator', function() {
|
|||
getProject: sinon.stub().callsArgWith(2, null, project)
|
||||
}
|
||||
return (this.locator = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/Project': { Project },
|
||||
'../../models/User': { User: this.User },
|
||||
|
|
|
@ -32,6 +32,9 @@ describe('ProjectOptionsHandler', function() {
|
|||
this.projectModel.update = sinon.spy()
|
||||
|
||||
return (this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/Project': { Project: this.projectModel },
|
||||
'settings-sharelatex': {
|
||||
|
|
|
@ -41,6 +41,9 @@ describe('ProjectRootDocManager', function() {
|
|||
stat: sinon.stub().callsArgWith(1, null, { size: 100 })
|
||||
}
|
||||
return (this.ProjectRootDocManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./ProjectEntityHandler': (this.ProjectEntityHandler = {}),
|
||||
'./ProjectEntityUpdateHandler': (this.ProjectEntityUpdateHandler = {}),
|
||||
|
|
|
@ -29,6 +29,9 @@ describe('ProjectUpdateHandler', function() {
|
|||
this.ProjectModel = Project = class Project {}
|
||||
this.ProjectModel.update = sinon.stub().callsArg(3)
|
||||
return (this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/Project': { Project: this.ProjectModel },
|
||||
'logger-sharelatex': { log: sinon.stub() }
|
||||
|
|
|
@ -29,6 +29,9 @@ describe('PublishersGetter', function() {
|
|||
}
|
||||
|
||||
this.PublishersGetter = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../User/UserGetter': this.UserGetter,
|
||||
'../UserMembership/UserMembershipsHandler': (this.UserMembershipsHandler = {
|
||||
|
|
|
@ -22,6 +22,9 @@ const modulePath = require('path').join(
|
|||
describe('ReferalAllocator', function() {
|
||||
beforeEach(function() {
|
||||
this.ReferalAllocator = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/User': {
|
||||
User: (this.User = {})
|
||||
|
|
|
@ -22,6 +22,9 @@ const modulePath = require('path').join(
|
|||
describe('Referal connect middle wear', function() {
|
||||
beforeEach(function() {
|
||||
return (this.connect = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log() {},
|
||||
|
|
|
@ -22,6 +22,9 @@ const modulePath = require('path').join(
|
|||
describe('Referal controller', () =>
|
||||
beforeEach(function() {
|
||||
return (this.controller = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log() {},
|
||||
|
|
|
@ -22,6 +22,9 @@ const modulePath = require('path').join(
|
|||
describe('ReferalFeatures', function() {
|
||||
beforeEach(function() {
|
||||
this.ReferalFeatures = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/User': {
|
||||
User: (this.User = {})
|
||||
|
|
|
@ -24,6 +24,9 @@ describe('Referal handler', function() {
|
|||
beforeEach(function() {
|
||||
this.User = { findById: sinon.stub() }
|
||||
this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log() {},
|
||||
|
|
|
@ -23,6 +23,9 @@ describe('ReferencesController', function() {
|
|||
beforeEach(function() {
|
||||
this.projectId = '2222'
|
||||
this.controller = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log() {},
|
||||
|
|
|
@ -48,6 +48,9 @@ describe('ReferencesHandler', function() {
|
|||
}
|
||||
this.docIds = ['aaa', 'ccc']
|
||||
this.handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log() {},
|
||||
|
|
|
@ -28,6 +28,9 @@ describe('LoginRateLimiter', function() {
|
|||
}
|
||||
|
||||
return (this.LoginRateLimiter = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../infrastructure/RateLimiter': this.RateLimiter
|
||||
}
|
||||
|
|
|
@ -29,6 +29,9 @@ describe('OneTimeTokenHandler', function() {
|
|||
this.stubbedToken = 'mock-token'
|
||||
this.callback = sinon.stub()
|
||||
return (this.OneTimeTokenHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -33,6 +33,9 @@ describe('RateLimiterMiddleware', function() {
|
|||
}
|
||||
}
|
||||
this.RateLimiterMiddleware = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../infrastructure/RateLimiter': (this.RateLimiter = {}),
|
||||
'logger-sharelatex': (this.logger = { warn: sinon.stub() }),
|
||||
|
|
|
@ -23,6 +23,9 @@ describe('FeaturesUpdater', function() {
|
|||
this.user_id = ObjectId().toString()
|
||||
|
||||
return (this.FeaturesUpdater = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./UserFeaturesUpdater': (this.UserFeaturesUpdater = {}),
|
||||
'./SubscriptionLocator': (this.SubscriptionLocator = {}),
|
||||
|
|
|
@ -50,6 +50,9 @@ describe('LimitationsManager', function() {
|
|||
}
|
||||
|
||||
return (this.LimitationsManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Project/ProjectGetter': this.ProjectGetter,
|
||||
'../User/UserGetter': this.UserGetter,
|
||||
|
|
|
@ -144,6 +144,9 @@ describe('RecurlyWrapper', function() {
|
|||
return (this.RecurlyWrapper = RecurlyWrapper = SandboxedModule.require(
|
||||
modulePath,
|
||||
{
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'settings-sharelatex': this.settings,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -91,6 +91,9 @@ describe('SubscriptionController', function() {
|
|||
this.GeoIpLookup = { getCurrencyCode: sinon.stub() }
|
||||
this.UserGetter = { getUser: sinon.stub().callsArgWith(2, null, this.user) }
|
||||
this.SubscriptionController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../Authentication/AuthenticationController': this
|
||||
.AuthenticationController,
|
||||
|
|
|
@ -59,6 +59,9 @@ describe('SubscriptionGroupController', function() {
|
|||
}
|
||||
|
||||
return (this.Controller = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./SubscriptionGroupHandler': this.GroupHandler,
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -86,6 +86,9 @@ describe('SubscriptionGroupHandler', function() {
|
|||
}
|
||||
|
||||
return (this.Handler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log() {}
|
||||
|
|
|
@ -87,6 +87,9 @@ describe('SubscriptionHandler', function() {
|
|||
this.AnalyticsManager = { recordEvent: sinon.stub() }
|
||||
|
||||
this.SubscriptionHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'./RecurlyWrapper': this.RecurlyWrapper,
|
||||
'settings-sharelatex': this.Settings,
|
||||
|
|
|
@ -28,6 +28,9 @@ describe('Subscription Locator Tests', function() {
|
|||
find: sinon.stub()
|
||||
}
|
||||
return (this.SubscriptionLocator = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/Subscription': {
|
||||
Subscription: this.Subscription
|
||||
|
|
|
@ -95,6 +95,9 @@ describe('SubscriptionUpdater', function() {
|
|||
refreshFeatures: sinon.stub().yields()
|
||||
}
|
||||
this.SubscriptionUpdater = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/Subscription': {
|
||||
Subscription: this.SubscriptionModel
|
||||
|
|
|
@ -83,6 +83,9 @@ describe('TeamInvitesHandler', function() {
|
|||
this.Subscription.findOne.yields(null, this.subscription)
|
||||
|
||||
this.TeamInvitesHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': { log() {} },
|
||||
crypto: this.crypto,
|
||||
|
|
|
@ -23,6 +23,9 @@ describe('UserFeaturesUpdater', function() {
|
|||
beforeEach(function() {
|
||||
this.User = { update: sinon.stub().callsArgWith(2) }
|
||||
return (this.UserFeaturesUpdater = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../models/User': {
|
||||
User: this.User
|
||||
|
|
|
@ -26,6 +26,9 @@ const { expect } = require('chai')
|
|||
describe('V1SubscriptionManager', function() {
|
||||
beforeEach(function() {
|
||||
this.V1SubscriptionManager = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../User/UserGetter': (this.UserGetter = {}),
|
||||
'logger-sharelatex': {
|
||||
|
|
|
@ -36,6 +36,9 @@ describe('SudoModeController', function() {
|
|||
}
|
||||
this.UserGetter = { getUser: sinon.stub() }
|
||||
return (this.SudoModeController = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'logger-sharelatex': {
|
||||
log: sinon.stub(),
|
||||
|
|
|
@ -32,6 +32,9 @@ describe('SudoModeHandler', function() {
|
|||
this.rclient = { get: sinon.stub(), set: sinon.stub(), del: sinon.stub() }
|
||||
this.RedisWrapper = { client: () => this.rclient }
|
||||
return (this.SudoModeHandler = SandboxedModule.require(modulePath, {
|
||||
globals: {
|
||||
console: console
|
||||
},
|
||||
requires: {
|
||||
'../../infrastructure/RedisWrapper': this.RedisWrapper,
|
||||
'logger-sharelatex': (this.logger = {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue