Merge pull request #28808 from overleaf/ii-await-user-handler
[web] Promisify UserHandler GitOrigin-RevId: 2daa6f74ec566851d208bf1b3d12d89ecf183383
This commit is contained in:
@@ -94,7 +94,9 @@ describe('AuthenticationController', function () {
|
||||
},
|
||||
}),
|
||||
'../User/UserHandler': (this.UserHandler = {
|
||||
populateTeamInvites: sinon.stub(),
|
||||
promises: {
|
||||
populateTeamInvites: sinon.stub().resolves(),
|
||||
},
|
||||
}),
|
||||
'../Analytics/AnalyticsManager': (this.AnalyticsManager = {
|
||||
recordEventForUserInBackground: sinon.stub(),
|
||||
@@ -556,7 +558,7 @@ describe('AuthenticationController', function () {
|
||||
})
|
||||
|
||||
it('should not setup the user data in the background', function () {
|
||||
this.UserHandler.populateTeamInvites.called.should.equal(false)
|
||||
this.UserHandler.promises.populateTeamInvites.called.should.equal(false)
|
||||
})
|
||||
|
||||
it('should record a failed login', function () {
|
||||
@@ -1134,7 +1136,7 @@ describe('AuthenticationController', function () {
|
||||
this.AuthenticationController._clearRedirectFromSession = sinon.stub()
|
||||
this.AuthenticationController._redirectToReconfirmPage = sinon.stub()
|
||||
this.UserSessionsManager.trackSession = sinon.stub()
|
||||
this.UserHandler.populateTeamInvites = sinon.stub()
|
||||
this.UserHandler.promises.populateTeamInvites = sinon.stub().resolves()
|
||||
this.LoginRateLimiter.recordSuccessfulLogin = sinon.stub()
|
||||
this.AuthenticationController._recordSuccessfulLogin = sinon.stub()
|
||||
this.AnalyticsManager.recordEvent = sinon.stub()
|
||||
@@ -1461,7 +1463,7 @@ describe('AuthenticationController', function () {
|
||||
})
|
||||
|
||||
it('should setup the user data in the background', function () {
|
||||
this.UserHandler.populateTeamInvites
|
||||
this.UserHandler.promises.populateTeamInvites
|
||||
.calledWith(this.user)
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
@@ -12,7 +12,9 @@ describe('UserHandler', function () {
|
||||
}
|
||||
|
||||
this.TeamInvitesHandler = {
|
||||
createTeamInvitesForLegacyInvitedEmail: sinon.stub().yields(),
|
||||
promises: {
|
||||
createTeamInvitesForLegacyInvitedEmail: sinon.stub().resolves(),
|
||||
},
|
||||
}
|
||||
|
||||
this.db = {
|
||||
@@ -30,12 +32,12 @@ describe('UserHandler', function () {
|
||||
})
|
||||
|
||||
describe('populateTeamInvites', function () {
|
||||
beforeEach(function (done) {
|
||||
this.UserHandler.populateTeamInvites(this.user, done)
|
||||
beforeEach(async function () {
|
||||
await this.UserHandler.promises.populateTeamInvites(this.user)
|
||||
})
|
||||
|
||||
it('notifies the user about legacy team invites', function () {
|
||||
this.TeamInvitesHandler.createTeamInvitesForLegacyInvitedEmail
|
||||
this.TeamInvitesHandler.promises.createTeamInvitesForLegacyInvitedEmail
|
||||
.calledWith(this.user.email)
|
||||
.should.eq(true)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user