From df44792a10d18d107e0a33fa0221ed9348117f3e Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Tue, 17 Jun 2014 11:48:14 +0100 Subject: [PATCH] fix tests in user info controller --- .../coffee/User/UserInfoControllerTests.coffee | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/web/test/UnitTests/coffee/User/UserInfoControllerTests.coffee b/services/web/test/UnitTests/coffee/User/UserInfoControllerTests.coffee index 66a3066855..c2d90de719 100644 --- a/services/web/test/UnitTests/coffee/User/UserInfoControllerTests.coffee +++ b/services/web/test/UnitTests/coffee/User/UserInfoControllerTests.coffee @@ -18,10 +18,14 @@ describe "UserInfoController", -> updatePersonalInfo: sinon.stub() @sanitizer = escape:(v)->v sinon.spy @sanitizer, "escape" + @UserGetter = {} + + @UserInfoController = SandboxedModule.require modulePath, requires: - "./UserGetter": @UserGetter = {} + "./UserGetter": @UserGetter "./UserUpdater": @UserUpdater "./UserDeleter": @UserDeleter + "logger-sharelatex": log:-> "sanitizer":@sanitizer @req = new MockRequest() @@ -33,7 +37,9 @@ describe "UserInfoController", -> @user = _id: ObjectId() @req.user = @user + @req.session.user = @user @UserInfoController.sendFormattedPersonalInfo = sinon.stub() + @UserGetter.getUser = sinon.stub().callsArgWith(2, null, @user) @UserInfoController.getLoggedInUsersPersonalInfo(@req, @res, @next) it "should call sendFormattedPersonalInfo", -> @@ -105,6 +111,8 @@ describe "UserInfoController", -> email: "doug@sharelatex.com" password: "should-not-get-included" signUpDate: new Date() + role:"student" + institution:"sheffield" @UserInfoController._formatPersonalInfo @user, (error, info) => expect(info).to.deep.equal { id: @user._id.toString() @@ -112,6 +120,8 @@ describe "UserInfoController", -> last_name: @user.last_name email: @user.email signUpDate: @user.signUpDate + role: @user.role + institution: @user.institution } describe "setPersonalInfo", ->