Merge pull request #14803 from overleaf/jpa-split-test-cache-alpha-beta

[web] invalidate split test cache when alpha/beta program status changes

GitOrigin-RevId: 3023d2adf8466b48490c51497f5c80e7b0a1fe3d
This commit is contained in:
Jakob Ackermann
2023-09-13 13:07:00 +02:00
committed by Copybot
parent 7d3c8fb78d
commit 1e4dcc84d9
8 changed files with 99 additions and 3 deletions
@@ -128,6 +128,7 @@ describe('ProjectController', function () {
getAssignment: sinon.stub().resolves({ variant: 'default' }),
},
getAssignment: sinon.stub().yields(null, { variant: 'default' }),
sessionMaintenance: sinon.stub().yields(),
}
this.InstitutionsFeatures = {
hasLicence: sinon.stub().callsArgWith(1, null, false),
@@ -515,6 +516,28 @@ describe('ProjectController', function () {
return this.ProjectController.loadEditor(this.req, this.res)
})
it('should invoke the session maintenance for logged in user', function (done) {
this.res.render = () => {
this.SplitTestHandler.sessionMaintenance.should.have.been.calledWith(
this.req,
this.user
)
done()
}
this.ProjectController.loadEditor(this.req, this.res)
})
it('should invoke the session maintenance for anonymous user', function (done) {
this.SessionManager.getLoggedInUserId.returns(null)
this.res.render = () => {
this.SplitTestHandler.sessionMaintenance.should.have.been.calledWith(
this.req
)
done()
}
this.ProjectController.loadEditor(this.req, this.res)
})
it('should render the closed page if the editor is closed', function (done) {
this.settings.editorIsOpen = false
this.res.render = (pageName, opts) => {