mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-31 12:51:35 +02:00
This reverts commit 54064a7f961fe06f188ab449cd469cdaaf01b20a. GitOrigin-RevId: 1dabc635756aff465d2fe9aa0d18121b081df3b0
This commit is contained in:
committed by
Copybot
parent
40b781eb0a
commit
511fe60a9c
@@ -25,10 +25,6 @@ describe('AuthorizationHelper', function () {
|
||||
},
|
||||
},
|
||||
},
|
||||
'../Project/ProjectGetter': (this.ProjectGetter = { promises: {} }),
|
||||
'../SplitTests/SplitTestHandler': (this.SplitTestHandler = {
|
||||
promises: {},
|
||||
}),
|
||||
},
|
||||
})
|
||||
})
|
||||
@@ -63,76 +59,4 @@ describe('AuthorizationHelper', function () {
|
||||
expect(this.AuthorizationHelper.hasAnyStaffAccess(user)).to.be.false
|
||||
})
|
||||
})
|
||||
|
||||
describe('isReviewerRoleEnabled', function () {
|
||||
it('with no reviewers and no split test', async function () {
|
||||
this.ProjectGetter.promises.getProject = sinon.stub().resolves({
|
||||
reviewer_refs: {},
|
||||
owner_ref: 'ownerId',
|
||||
})
|
||||
this.SplitTestHandler.promises.getAssignmentForUser = sinon
|
||||
.stub()
|
||||
.resolves({
|
||||
variant: 'disabled',
|
||||
})
|
||||
expect(
|
||||
await this.AuthorizationHelper.promises.isReviewerRoleEnabled(
|
||||
'userId',
|
||||
'projectId'
|
||||
)
|
||||
).to.be.false
|
||||
})
|
||||
|
||||
it('with no reviewers and enabled split test', async function () {
|
||||
this.ProjectGetter.promises.getProject = sinon.stub().resolves({
|
||||
reviewer_refs: {},
|
||||
owner_ref: 'userId',
|
||||
})
|
||||
this.SplitTestHandler.promises.getAssignmentForUser = sinon
|
||||
.stub()
|
||||
.resolves({
|
||||
variant: 'enabled',
|
||||
})
|
||||
expect(
|
||||
await this.AuthorizationHelper.promises.isReviewerRoleEnabled(
|
||||
'userId',
|
||||
'projectId'
|
||||
)
|
||||
).to.be.true
|
||||
})
|
||||
|
||||
it('with reviewers and disabled split test', async function () {
|
||||
this.ProjectGetter.promises.getProject = sinon.stub().resolves({
|
||||
reviewer_refs: [{ $oid: 'userId' }],
|
||||
})
|
||||
this.SplitTestHandler.promises.getAssignmentForUser = sinon
|
||||
.stub()
|
||||
.resolves({
|
||||
variant: 'default',
|
||||
})
|
||||
expect(
|
||||
await this.AuthorizationHelper.promises.isReviewerRoleEnabled(
|
||||
'userId',
|
||||
'projectId'
|
||||
)
|
||||
).to.be.true
|
||||
})
|
||||
|
||||
it('with reviewers and enabled split test', async function () {
|
||||
this.ProjectGetter.promises.getProject = sinon.stub().resolves({
|
||||
reviewer_refs: [{ $oid: 'userId' }],
|
||||
})
|
||||
this.SplitTestHandler.promises.getAssignmentForUser = sinon
|
||||
.stub()
|
||||
.resolves({
|
||||
variant: 'enabled',
|
||||
})
|
||||
expect(
|
||||
await this.AuthorizationHelper.promises.isReviewerRoleEnabled(
|
||||
'userId',
|
||||
'projectId'
|
||||
)
|
||||
).to.be.true
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user