Merge pull request #1937 from overleaf/spd-sandboxedmodule-global-console

Add 'console' to SandboxedModule globals

GitOrigin-RevId: fad442ca128561a4fa193b929f217cf31ad0f043
This commit is contained in:
Shane Kilkelly 2019-07-15 11:33:47 +01:00 committed by sharelatex
parent 9cc5dc968c
commit 238e2b2565
142 changed files with 453 additions and 0 deletions

View file

@ -20,6 +20,9 @@ describe('AnalyticsController', function() {
}
this.controller = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./AnalyticsManager': this.AnalyticsManager,
'../Authentication/AuthenticationController': this

View file

@ -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': {

View file

@ -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,

View file

@ -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 = {

View file

@ -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 = {})

View file

@ -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 = {}),

View file

@ -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() {} },

View file

@ -37,6 +37,9 @@ describe('BetaProgramController', function() {
}
}
this.BetaProgramController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./BetaProgramHandler': (this.BetaProgramHandler = {
optIn: sinon.stub(),

View file

@ -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: {

View file

@ -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': {

View file

@ -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,

View file

@ -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': {

View file

@ -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': {

View file

@ -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 = {}),

View file

@ -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(),

View file

@ -44,6 +44,9 @@ describe('CollaboratorsInviteController', function() {
}
this.CollaboratorsInviteController = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../Project/ProjectGetter': (this.ProjectGetter = {}),
'../Subscription/LimitationsManager': this.LimitationsManager,

View file

@ -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 },

View file

@ -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(

View file

@ -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 = {

View file

@ -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: {

View file

@ -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 = {}),

View file

@ -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()),

View file

@ -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 } }

View file

@ -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(),

View file

@ -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 = {

View file

@ -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() }

View file

@ -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() }

View file

@ -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

View file

@ -49,6 +49,9 @@ describe('DocumentUpdaterHandler', function() {
this.callback = sinon.stub()
return (this.handler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
request: {
defaults: () => {

View file

@ -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() {},

View file

@ -30,6 +30,9 @@ describe('ProjectDownloadsController', function() {
return (this.ProjectDownloadsController = SandboxedModule.require(
modulePath,
{
globals: {
console: console
},
requires: {
'./ProjectZipStreamManager': (this.ProjectZipStreamManager = {}),
'../Project/ProjectGetter': (this.ProjectGetter = {}),

View file

@ -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 = {

View file

@ -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 = {

View file

@ -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 = {}),

View file

@ -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

View file

@ -31,6 +31,9 @@ describe('EmailBuilder', function() {
brandPrefix: ''
}
return (this.EmailBuilder = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
'logger-sharelatex': {

View file

@ -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,

View file

@ -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': {},

View file

@ -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': {

View file

@ -27,6 +27,9 @@ describe('ExportsHandler', function() {
}
}
this.ExportsHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': {
log() {},

View file

@ -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 = {

View file

@ -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,

View file

@ -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 = {}),

View file

@ -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 = {}),

View file

@ -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 = {}),

View file

@ -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': {

View file

@ -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': {

View file

@ -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': {

View file

@ -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,

View file

@ -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 = {}),

View file

@ -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': {

View file

@ -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(),

View file

@ -54,6 +54,9 @@ describe('MetaHandler', function() {
}
return (this.MetaHandler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../Project/ProjectEntityHandler': this.ProjectEntityHandler,
'../DocumentUpdater/DocumentUpdaterHandler': this

View file

@ -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,

View file

@ -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 = {

View file

@ -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 } }

View file

@ -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,

View file

@ -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,

View file

@ -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() {} }
}

View file

@ -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': {

View file

@ -34,6 +34,9 @@ describe('ProjectCollabratecDetailsHandler', function() {
this.ProjectCollabratecDetailsHandler = SandboxedModule.require(
modulePath,
{
globals: {
console: console
},
requires: {
'../../models/Project': { Project: this.ProjectModel }
}

View file

@ -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': {

View file

@ -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

View file

@ -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 },

View file

@ -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': {

View file

@ -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

View file

@ -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(),

View file

@ -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(),

View file

@ -85,6 +85,9 @@ describe('ProjectEntityUpdateHandler', function() {
return (this.ProjectEntityUpdateHandler = SandboxedModule.require(
modulePath,
{
globals: {
console: console
},
requires: {
'logger-sharelatex': (this.logger = {
log: sinon.stub(),

View file

@ -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 = {

View file

@ -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(),

View file

@ -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 },

View file

@ -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': {

View file

@ -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 = {}),

View file

@ -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() }

View file

@ -29,6 +29,9 @@ describe('PublishersGetter', function() {
}
this.PublishersGetter = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../User/UserGetter': this.UserGetter,
'../UserMembership/UserMembershipsHandler': (this.UserMembershipsHandler = {

View file

@ -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 = {})

View file

@ -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() {},

View file

@ -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() {},

View file

@ -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 = {})

View file

@ -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() {},

View file

@ -23,6 +23,9 @@ describe('ReferencesController', function() {
beforeEach(function() {
this.projectId = '2222'
this.controller = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': {
log() {},

View file

@ -48,6 +48,9 @@ describe('ReferencesHandler', function() {
}
this.docIds = ['aaa', 'ccc']
this.handler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': {
log() {},

View file

@ -28,6 +28,9 @@ describe('LoginRateLimiter', function() {
}
return (this.LoginRateLimiter = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'../../infrastructure/RateLimiter': this.RateLimiter
}

View file

@ -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': {

View file

@ -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() }),

View file

@ -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 = {}),

View file

@ -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,

View file

@ -144,6 +144,9 @@ describe('RecurlyWrapper', function() {
return (this.RecurlyWrapper = RecurlyWrapper = SandboxedModule.require(
modulePath,
{
globals: {
console: console
},
requires: {
'settings-sharelatex': this.settings,
'logger-sharelatex': {

View file

@ -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,

View file

@ -59,6 +59,9 @@ describe('SubscriptionGroupController', function() {
}
return (this.Controller = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'./SubscriptionGroupHandler': this.GroupHandler,
'logger-sharelatex': {

View file

@ -86,6 +86,9 @@ describe('SubscriptionGroupHandler', function() {
}
return (this.Handler = SandboxedModule.require(modulePath, {
globals: {
console: console
},
requires: {
'logger-sharelatex': {
log() {}

View file

@ -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,

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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': {

View file

@ -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(),

View file

@ -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