Merge pull request #3495 from overleaf/ae-prettier-2

Upgrade Prettier to v2

GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
This commit is contained in:
Alf Eaton
2021-04-15 02:05:22 +00:00
committed by Copybot
parent 930d7ba028
commit 1ebc8a79cb
582 changed files with 20382 additions and 20374 deletions
@@ -19,8 +19,8 @@ const SandboxedModule = require('sandboxed-module')
const Errors = require('../../../../app/src/Features/Errors/Errors.js')
const { ObjectId } = require('mongodb')
describe('AuthorizationManager', function() {
beforeEach(function() {
describe('AuthorizationManager', function () {
beforeEach(function () {
this.AuthorizationManager = SandboxedModule.require(modulePath, {
requires: {
mongodb: { ObjectId },
@@ -44,8 +44,8 @@ describe('AuthorizationManager', function() {
return (this.callback = sinon.stub())
})
describe('isRestrictedUser', function() {
it('should produce the correct values', function() {
describe('isRestrictedUser', function () {
it('should produce the correct values', function () {
const notRestrictedScenarios = [
[null, 'readAndWrite', false],
['id', 'readAndWrite', true],
@@ -72,22 +72,22 @@ describe('AuthorizationManager', function() {
})
})
describe('getPrivilegeLevelForProject', function() {
beforeEach(function() {
describe('getPrivilegeLevelForProject', function () {
beforeEach(function () {
this.ProjectGetter.getProject = sinon.stub()
this.AuthorizationManager.isUserSiteAdmin = sinon.stub()
return (this.CollaboratorsGetter.getMemberIdPrivilegeLevel = sinon.stub())
})
describe('with a token-based project', function() {
beforeEach(function() {
describe('with a token-based project', function () {
beforeEach(function () {
return this.ProjectGetter.getProject
.withArgs(this.project_id, { publicAccesLevel: 1 })
.yields(null, { publicAccesLevel: 'tokenBased' })
})
describe('with a user_id with a privilege level', function() {
beforeEach(function() {
describe('with a user_id with a privilege level', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, false)
@@ -102,15 +102,15 @@ describe('AuthorizationManager', function() {
)
})
it("should return the user's privilege level", function() {
it("should return the user's privilege level", function () {
return this.callback
.calledWith(null, 'readOnly', false, false)
.should.equal(true)
})
})
describe('with a user_id with no privilege level', function() {
beforeEach(function() {
describe('with a user_id with no privilege level', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, false)
@@ -125,15 +125,15 @@ describe('AuthorizationManager', function() {
)
})
it('should return false', function() {
it('should return false', function () {
return this.callback
.calledWith(null, false, false, false)
.should.equal(true)
})
})
describe('with a user_id who is an admin', function() {
beforeEach(function() {
describe('with a user_id who is an admin', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, true)
@@ -148,16 +148,16 @@ describe('AuthorizationManager', function() {
)
})
it('should return the user as an owner', function() {
it('should return the user as an owner', function () {
return this.callback
.calledWith(null, 'owner', false, true)
.should.equal(true)
})
})
describe('with no user (anonymous)', function() {
describe('when the token is not valid', function() {
beforeEach(function() {
describe('with no user (anonymous)', function () {
describe('when the token is not valid', function () {
beforeEach(function () {
this.TokenAccessHandler.validateTokenForAnonymousAccess = sinon
.stub()
.withArgs(this.project_id, this.token)
@@ -170,33 +170,33 @@ describe('AuthorizationManager', function() {
)
})
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function() {
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () {
return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal(
false
)
})
it('should not call AuthorizationManager.isUserSiteAdmin', function() {
it('should not call AuthorizationManager.isUserSiteAdmin', function () {
return this.AuthorizationManager.isUserSiteAdmin.called.should.equal(
false
)
})
it('should check if the token is valid', function() {
it('should check if the token is valid', function () {
return this.TokenAccessHandler.validateTokenForAnonymousAccess
.calledWith(this.project_id, this.token)
.should.equal(true)
})
it('should return false', function() {
it('should return false', function () {
return this.callback
.calledWith(null, false, false, false)
.should.equal(true)
})
})
describe('when the token is valid for read-and-write', function() {
beforeEach(function() {
describe('when the token is valid for read-and-write', function () {
beforeEach(function () {
this.TokenAccessHandler.validateTokenForAnonymousAccess = sinon
.stub()
.withArgs(this.project_id, this.token)
@@ -209,33 +209,33 @@ describe('AuthorizationManager', function() {
)
})
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function() {
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () {
return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal(
false
)
})
it('should not call AuthorizationManager.isUserSiteAdmin', function() {
it('should not call AuthorizationManager.isUserSiteAdmin', function () {
return this.AuthorizationManager.isUserSiteAdmin.called.should.equal(
false
)
})
it('should check if the token is valid', function() {
it('should check if the token is valid', function () {
return this.TokenAccessHandler.validateTokenForAnonymousAccess
.calledWith(this.project_id, this.token)
.should.equal(true)
})
it('should give read-write access', function() {
it('should give read-write access', function () {
return this.callback
.calledWith(null, 'readAndWrite', false)
.should.equal(true)
})
})
describe('when the token is valid for read-only', function() {
beforeEach(function() {
describe('when the token is valid for read-only', function () {
beforeEach(function () {
this.TokenAccessHandler.validateTokenForAnonymousAccess = sinon
.stub()
.withArgs(this.project_id, this.token)
@@ -248,25 +248,25 @@ describe('AuthorizationManager', function() {
)
})
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function() {
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () {
return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal(
false
)
})
it('should not call AuthorizationManager.isUserSiteAdmin', function() {
it('should not call AuthorizationManager.isUserSiteAdmin', function () {
return this.AuthorizationManager.isUserSiteAdmin.called.should.equal(
false
)
})
it('should check if the token is valid', function() {
it('should check if the token is valid', function () {
return this.TokenAccessHandler.validateTokenForAnonymousAccess
.calledWith(this.project_id, this.token)
.should.equal(true)
})
it('should give read-only access', function() {
it('should give read-only access', function () {
return this.callback
.calledWith(null, 'readOnly', false)
.should.equal(true)
@@ -275,15 +275,15 @@ describe('AuthorizationManager', function() {
})
})
describe('with a private project', function() {
beforeEach(function() {
describe('with a private project', function () {
beforeEach(function () {
return this.ProjectGetter.getProject
.withArgs(this.project_id, { publicAccesLevel: 1 })
.yields(null, { publicAccesLevel: 'private' })
})
describe('with a user_id with a privilege level', function() {
beforeEach(function() {
describe('with a user_id with a privilege level', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, false)
@@ -298,15 +298,15 @@ describe('AuthorizationManager', function() {
)
})
it("should return the user's privilege level", function() {
it("should return the user's privilege level", function () {
return this.callback
.calledWith(null, 'readOnly', false, false)
.should.equal(true)
})
})
describe('with a user_id with no privilege level', function() {
beforeEach(function() {
describe('with a user_id with no privilege level', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, false)
@@ -321,15 +321,15 @@ describe('AuthorizationManager', function() {
)
})
it('should return false', function() {
it('should return false', function () {
return this.callback
.calledWith(null, false, false, false)
.should.equal(true)
})
})
describe('with a user_id who is an admin', function() {
beforeEach(function() {
describe('with a user_id who is an admin', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, true)
@@ -344,15 +344,15 @@ describe('AuthorizationManager', function() {
)
})
it('should return the user as an owner', function() {
it('should return the user as an owner', function () {
return this.callback
.calledWith(null, 'owner', false, true)
.should.equal(true)
})
})
describe('with no user (anonymous)', function() {
beforeEach(function() {
describe('with no user (anonymous)', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject(
null,
this.project_id,
@@ -361,19 +361,19 @@ describe('AuthorizationManager', function() {
)
})
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function() {
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () {
return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal(
false
)
})
it('should not call AuthorizationManager.isUserSiteAdmin', function() {
it('should not call AuthorizationManager.isUserSiteAdmin', function () {
return this.AuthorizationManager.isUserSiteAdmin.called.should.equal(
false
)
})
it('should return false', function() {
it('should return false', function () {
return this.callback
.calledWith(null, false, false, false)
.should.equal(true)
@@ -381,15 +381,15 @@ describe('AuthorizationManager', function() {
})
})
describe('with a public project', function() {
beforeEach(function() {
describe('with a public project', function () {
beforeEach(function () {
return this.ProjectGetter.getProject
.withArgs(this.project_id, { publicAccesLevel: 1 })
.yields(null, { publicAccesLevel: 'readAndWrite' })
})
describe('with a user_id with a privilege level', function() {
beforeEach(function() {
describe('with a user_id with a privilege level', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, false)
@@ -404,15 +404,15 @@ describe('AuthorizationManager', function() {
)
})
it("should return the user's privilege level", function() {
it("should return the user's privilege level", function () {
return this.callback
.calledWith(null, 'readOnly', false)
.should.equal(true)
})
})
describe('with a user_id with no privilege level', function() {
beforeEach(function() {
describe('with a user_id with no privilege level', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, false)
@@ -427,15 +427,15 @@ describe('AuthorizationManager', function() {
)
})
it('should return the public privilege level', function() {
it('should return the public privilege level', function () {
return this.callback
.calledWith(null, 'readAndWrite', true)
.should.equal(true)
})
})
describe('with a user_id who is an admin', function() {
beforeEach(function() {
describe('with a user_id who is an admin', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, true)
@@ -450,15 +450,15 @@ describe('AuthorizationManager', function() {
)
})
it('should return the user as an owner', function() {
it('should return the user as an owner', function () {
return this.callback
.calledWith(null, 'owner', false)
.should.equal(true)
})
})
describe('with no user (anonymous)', function() {
beforeEach(function() {
describe('with no user (anonymous)', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject(
null,
this.project_id,
@@ -467,19 +467,19 @@ describe('AuthorizationManager', function() {
)
})
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function() {
it('should not call CollaboratorsGetter.getMemberIdPrivilegeLevel', function () {
return this.CollaboratorsGetter.getMemberIdPrivilegeLevel.called.should.equal(
false
)
})
it('should not call AuthorizationManager.isUserSiteAdmin', function() {
it('should not call AuthorizationManager.isUserSiteAdmin', function () {
return this.AuthorizationManager.isUserSiteAdmin.called.should.equal(
false
)
})
it('should return the public privilege level', function() {
it('should return the public privilege level', function () {
return this.callback
.calledWith(null, 'readAndWrite', true)
.should.equal(true)
@@ -487,14 +487,14 @@ describe('AuthorizationManager', function() {
})
})
describe("when the project doesn't exist", function() {
beforeEach(function() {
describe("when the project doesn't exist", function () {
beforeEach(function () {
return this.ProjectGetter.getProject
.withArgs(this.project_id, { publicAccesLevel: 1 })
.yields(null, null)
})
it('should return a NotFoundError', function() {
it('should return a NotFoundError', function () {
return this.AuthorizationManager.getPrivilegeLevelForProject(
this.user_id,
this.project_id,
@@ -504,8 +504,8 @@ describe('AuthorizationManager', function() {
})
})
describe('when the project id is not valid', function() {
beforeEach(function() {
describe('when the project id is not valid', function () {
beforeEach(function () {
this.AuthorizationManager.isUserSiteAdmin
.withArgs(this.user_id)
.yields(null, false)
@@ -514,7 +514,7 @@ describe('AuthorizationManager', function() {
.yields(null, 'readOnly')
})
it('should return a error', function(done) {
it('should return a error', function (done) {
return this.AuthorizationManager.getPrivilegeLevelForProject(
undefined,
'not project id',
@@ -529,19 +529,19 @@ describe('AuthorizationManager', function() {
})
})
describe('canUserReadProject', function() {
beforeEach(function() {
describe('canUserReadProject', function () {
beforeEach(function () {
return (this.AuthorizationManager.getPrivilegeLevelForProject = sinon.stub())
})
describe('when user is owner', function() {
beforeEach(function() {
describe('when user is owner', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'owner', false)
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.canUserReadProject(
this.user_id,
this.project_id,
@@ -554,14 +554,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-write access', function() {
beforeEach(function() {
describe('when user has read-write access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readAndWrite', false)
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.canUserReadProject(
this.user_id,
this.project_id,
@@ -574,14 +574,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-only access', function() {
beforeEach(function() {
describe('when user has read-only access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readOnly', false)
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.canUserReadProject(
this.user_id,
this.project_id,
@@ -594,14 +594,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has no access', function() {
beforeEach(function() {
describe('when user has no access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, false, false)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserReadProject(
this.user_id,
this.project_id,
@@ -615,19 +615,19 @@ describe('AuthorizationManager', function() {
})
})
describe('canUserWriteProjectContent', function() {
beforeEach(function() {
describe('canUserWriteProjectContent', function () {
beforeEach(function () {
return (this.AuthorizationManager.getPrivilegeLevelForProject = sinon.stub())
})
describe('when user is owner', function() {
beforeEach(function() {
describe('when user is owner', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'owner', false)
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.canUserWriteProjectContent(
this.user_id,
this.project_id,
@@ -640,14 +640,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-write access', function() {
beforeEach(function() {
describe('when user has read-write access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readAndWrite', false)
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.canUserWriteProjectContent(
this.user_id,
this.project_id,
@@ -660,14 +660,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-only access', function() {
beforeEach(function() {
describe('when user has read-only access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readOnly', false)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserWriteProjectContent(
this.user_id,
this.project_id,
@@ -680,14 +680,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has no access', function() {
beforeEach(function() {
describe('when user has no access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, false, false)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserWriteProjectContent(
this.user_id,
this.project_id,
@@ -701,19 +701,19 @@ describe('AuthorizationManager', function() {
})
})
describe('canUserWriteProjectSettings', function() {
beforeEach(function() {
describe('canUserWriteProjectSettings', function () {
beforeEach(function () {
return (this.AuthorizationManager.getPrivilegeLevelForProject = sinon.stub())
})
describe('when user is owner', function() {
beforeEach(function() {
describe('when user is owner', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'owner', false)
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.canUserWriteProjectSettings(
this.user_id,
this.project_id,
@@ -726,14 +726,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-write access as a collaborator', function() {
beforeEach(function() {
describe('when user has read-write access as a collaborator', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readAndWrite', false)
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.canUserWriteProjectSettings(
this.user_id,
this.project_id,
@@ -746,14 +746,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-write access as the public', function() {
beforeEach(function() {
describe('when user has read-write access as the public', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readAndWrite', true)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserWriteProjectSettings(
this.user_id,
this.project_id,
@@ -766,14 +766,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-only access', function() {
beforeEach(function() {
describe('when user has read-only access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readOnly', false)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserWriteProjectSettings(
this.user_id,
this.project_id,
@@ -786,14 +786,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has no access', function() {
beforeEach(function() {
describe('when user has no access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, false, false)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserWriteProjectSettings(
this.user_id,
this.project_id,
@@ -807,19 +807,19 @@ describe('AuthorizationManager', function() {
})
})
describe('canUserAdminProject', function() {
beforeEach(function() {
describe('canUserAdminProject', function () {
beforeEach(function () {
return (this.AuthorizationManager.getPrivilegeLevelForProject = sinon.stub())
})
describe('when user is owner', function() {
beforeEach(function() {
describe('when user is owner', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'owner', false)
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.canUserAdminProject(
this.user_id,
this.project_id,
@@ -832,14 +832,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-write access', function() {
beforeEach(function() {
describe('when user has read-write access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readAndWrite', false)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserAdminProject(
this.user_id,
this.project_id,
@@ -852,14 +852,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has read-only access', function() {
beforeEach(function() {
describe('when user has read-only access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, 'readOnly', false)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserAdminProject(
this.user_id,
this.project_id,
@@ -872,14 +872,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user has no access', function() {
beforeEach(function() {
describe('when user has no access', function () {
beforeEach(function () {
return this.AuthorizationManager.getPrivilegeLevelForProject
.withArgs(this.user_id, this.project_id, this.token)
.yields(null, false, false)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.canUserAdminProject(
this.user_id,
this.project_id,
@@ -893,19 +893,19 @@ describe('AuthorizationManager', function() {
})
})
describe('isUserSiteAdmin', function() {
beforeEach(function() {
describe('isUserSiteAdmin', function () {
beforeEach(function () {
return (this.User.findOne = sinon.stub())
})
describe('when user is admin', function() {
beforeEach(function() {
describe('when user is admin', function () {
beforeEach(function () {
return this.User.findOne
.withArgs({ _id: this.user_id }, { isAdmin: 1 })
.yields(null, { isAdmin: true })
})
it('should return true', function(done) {
it('should return true', function (done) {
return this.AuthorizationManager.isUserSiteAdmin(
this.user_id,
(error, isAdmin) => {
@@ -916,14 +916,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user is not admin', function() {
beforeEach(function() {
describe('when user is not admin', function () {
beforeEach(function () {
return this.User.findOne
.withArgs({ _id: this.user_id }, { isAdmin: 1 })
.yields(null, { isAdmin: false })
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.isUserSiteAdmin(
this.user_id,
(error, isAdmin) => {
@@ -934,14 +934,14 @@ describe('AuthorizationManager', function() {
})
})
describe('when user is not found', function() {
beforeEach(function() {
describe('when user is not found', function () {
beforeEach(function () {
return this.User.findOne
.withArgs({ _id: this.user_id }, { isAdmin: 1 })
.yields(null, null)
})
it('should return false', function(done) {
it('should return false', function (done) {
return this.AuthorizationManager.isUserSiteAdmin(
this.user_id,
(error, isAdmin) => {
@@ -952,8 +952,8 @@ describe('AuthorizationManager', function() {
})
})
describe('when no user is passed', function() {
it('should return false', function(done) {
describe('when no user is passed', function () {
it('should return false', function (done) {
return this.AuthorizationManager.isUserSiteAdmin(
null,
(error, isAdmin) => {