From bd54cc722a6f03c1967d1fa126b844167e5e7302 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Thu, 18 Feb 2016 10:16:50 +0000 Subject: [PATCH] fixed broken tests in AuthenticationController --- services/web/app/coffee/Features/User/UserHandler.coffee | 2 +- .../Authentication/AuthenticationControllerTests.coffee | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/User/UserHandler.coffee b/services/web/app/coffee/Features/User/UserHandler.coffee index 2fb232bef9..5e924573dd 100644 --- a/services/web/app/coffee/Features/User/UserHandler.coffee +++ b/services/web/app/coffee/Features/User/UserHandler.coffee @@ -16,5 +16,5 @@ module.exports = UserHandler = NotificationsBuilder.groupPlan(user, licence).create(callback) setupLoginData: (user, callback = ->)-> - _populateGroupLicenceInvite user, callback + @_populateGroupLicenceInvite user, callback diff --git a/services/web/test/UnitTests/coffee/Authentication/AuthenticationControllerTests.coffee b/services/web/test/UnitTests/coffee/Authentication/AuthenticationControllerTests.coffee index 10d0e87b12..63ff12a374 100644 --- a/services/web/test/UnitTests/coffee/Authentication/AuthenticationControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/Authentication/AuthenticationControllerTests.coffee @@ -18,6 +18,7 @@ describe "AuthenticationController", -> "../User/UserUpdater" : @UserUpdater = {} "../../infrastructure/Metrics": @Metrics = { inc: sinon.stub() } "../Security/LoginRateLimiter": @LoginRateLimiter = { processLoginRequest:sinon.stub(), recordSuccessfulLogin:sinon.stub() } + "../User/UserHandler": @UserHandler = {setupLoginData:sinon.stub()} "logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub() } "settings-sharelatex": {} @user = @@ -68,6 +69,9 @@ describe "AuthenticationController", -> .calledWith(email: @email.toLowerCase(), @password) .should.equal true + it "should setup the user data in the background", -> + @UserHandler.setupLoginData.calledWith(@user).should.equal true + it "should establish the user's session", -> @AuthenticationController.establishUserSession .calledWith(@req, @user) @@ -108,6 +112,9 @@ describe "AuthenticationController", -> it "should not establish a session", -> @AuthenticationController.establishUserSession.called.should.equal false + + it "should not setup the user data in the background", -> + @UserHandler.setupLoginData.called.should.equal false it "should record a failed login", -> @AuthenticationController._recordFailedLogin.called.should.equal true