Merge pull request #4338 from overleaf/ab-session-manager

Extract functions from AuthenticationController to SessionManager

GitOrigin-RevId: 86870ce03a762e1a837dcf493759e8851e759883
This commit is contained in:
Alexandre Bourdin
2021-07-28 12:36:22 +00:00
committed by Copybot
parent 7e61fc4035
commit 9468e5cb4f
66 changed files with 460 additions and 458 deletions
@@ -9,7 +9,7 @@ const modulePath = require('path').join(
describe('TpdsController', function () {
beforeEach(function () {
this.TpdsUpdateHandler = {}
this.AuthenticationController = {
this.SessionManager = {
getLoggedInUserId: sinon.stub().returns('user-id'),
}
this.TpdsQueueManager = {
@@ -24,8 +24,7 @@ describe('TpdsController', function () {
'../Notifications/NotificationsBuilder': (this.NotificationsBuilder = {
tpdsFileLimit: sinon.stub().returns({ create: sinon.stub() }),
}),
'../Authentication/AuthenticationController': this
.AuthenticationController,
'../Authentication/SessionManager': this.SessionManager,
'./TpdsQueueManager': this.TpdsQueueManager,
'@overleaf/metrics': {
inc() {},
@@ -271,8 +270,7 @@ describe('TpdsController', function () {
})
it('should use userId from session', function () {
this.AuthenticationController.getLoggedInUserId.should.have.been
.calledOnce
this.SessionManager.getLoggedInUserId.should.have.been.calledOnce
this.TpdsQueueManager.promises.getQueues.should.have.been.calledWith(
'user-id'
)