Merge pull request #4338 from overleaf/ab-session-manager
Extract functions from AuthenticationController to SessionManager GitOrigin-RevId: 86870ce03a762e1a837dcf493759e8851e759883
This commit is contained in:
committed by
Copybot
parent
7e61fc4035
commit
9468e5cb4f
@@ -47,7 +47,7 @@ describe('SubscriptionController', function () {
|
||||
this.activeRecurlySubscription =
|
||||
mockSubscriptions['subscription-123-active']
|
||||
|
||||
this.AuthenticationController = {
|
||||
this.SessionManager = {
|
||||
getLoggedInUser: sinon.stub().callsArgWith(1, null, this.user),
|
||||
getLoggedInUserId: sinon.stub().returns(this.user._id),
|
||||
getSessionUser: sinon.stub().returns(this.user),
|
||||
@@ -121,8 +121,7 @@ describe('SubscriptionController', function () {
|
||||
}
|
||||
this.SubscriptionController = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'../Authentication/AuthenticationController': this
|
||||
.AuthenticationController,
|
||||
'../Authentication/SessionManager': this.SessionManager,
|
||||
'./SubscriptionHandler': this.SubscriptionHandler,
|
||||
'./PlansLocator': this.PlansLocator,
|
||||
'./SubscriptionViewModelBuilder': this.SubscriptionViewModelBuilder,
|
||||
|
||||
@@ -46,12 +46,12 @@ describe('SubscriptionGroupController', function () {
|
||||
getSubscription: sinon.stub().callsArgWith(1, null, this.subscription),
|
||||
}
|
||||
|
||||
this.AuthenticationController = {
|
||||
getLoggedInUserId(req) {
|
||||
return req.session.user._id
|
||||
this.SessionManager = {
|
||||
getLoggedInUserId(session) {
|
||||
return session.user._id
|
||||
},
|
||||
getSessionUser(req) {
|
||||
return req.session.user
|
||||
getSessionUser(session) {
|
||||
return session.user
|
||||
},
|
||||
}
|
||||
|
||||
@@ -59,8 +59,7 @@ describe('SubscriptionGroupController', function () {
|
||||
requires: {
|
||||
'./SubscriptionGroupHandler': this.GroupHandler,
|
||||
'./SubscriptionLocator': this.SubscriptionLocator,
|
||||
'../Authentication/AuthenticationController': this
|
||||
.AuthenticationController,
|
||||
'../Authentication/SessionManager': this.SessionManager,
|
||||
},
|
||||
}))
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user