From 20835a79e2cf34beed9d3a67a95329d0254f7df8 Mon Sep 17 00:00:00 2001 From: Douglas Lovell Date: Tue, 26 Jun 2018 13:45:31 -0300 Subject: [PATCH 1/2] Repair not logged in subscription controller test --- .../coffee/Subscription/SubscriptionControllerTests.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/web/test/unit/coffee/Subscription/SubscriptionControllerTests.coffee b/services/web/test/unit/coffee/Subscription/SubscriptionControllerTests.coffee index 0fb9344108..f6808727d1 100644 --- a/services/web/test/unit/coffee/Subscription/SubscriptionControllerTests.coffee +++ b/services/web/test/unit/coffee/Subscription/SubscriptionControllerTests.coffee @@ -124,13 +124,11 @@ describe "SubscriptionController", -> @UserGetter = getUser: sinon.stub().callsArgWith(2, null, null) @res.callback = done - @SubscriptionController.plansPage(@req, @res) @AuthenticationController = getLoggedInUser: sinon.stub().callsArgWith(1, null, null) getLoggedInUserId: sinon.stub().returns(null) getSessionUser: sinon.stub().returns(null) isUserLoggedIn: sinon.stub().returns(false) - @SubscriptionController = SandboxedModule.require modulePath, requires: '../Authentication/AuthenticationController': @AuthenticationController './SubscriptionHandler': @SubscriptionHandler @@ -146,6 +144,7 @@ describe "SubscriptionController", -> "../User/UserGetter": @UserGetter "./RecurlyWrapper": @RecurlyWrapper = {} "./FeaturesUpdater": @FeaturesUpdater = {} + @SubscriptionController.plansPage(@req, @res) it 'should not fetch the current user', (done) -> @UserGetter.getUser.callCount.should.equal 0 @@ -500,4 +499,4 @@ describe "SubscriptionController", -> @SubscriptionHandler.updateSubscription.calledWith(@user, "collaborator-annual", "COLLABORATORCODEHERE").should.equal true done() - @SubscriptionController.processUpgradeToAnnualPlan @req, @res \ No newline at end of file + @SubscriptionController.processUpgradeToAnnualPlan @req, @res From 1df5b0b9428431d01c6dca9fcf65043434e25f1d Mon Sep 17 00:00:00 2001 From: Douglas Lovell Date: Mon, 25 Jun 2018 20:27:47 -0300 Subject: [PATCH 2/2] Fixup mixed indentation --- .../Authentication/AuthenticationController.coffee | 4 +--- .../Features/HealthCheck/HealthCheckController.coffee | 2 +- .../web/app/coffee/Features/User/UserController.coffee | 8 ++++---- .../Authentication/AuthenticationControllerTests.coffee | 2 +- .../unit/coffee/Exports/ExportsControllerTests.coffee | 4 ++-- 5 files changed, 9 insertions(+), 11 deletions(-) diff --git a/services/web/app/coffee/Features/Authentication/AuthenticationController.coffee b/services/web/app/coffee/Features/Authentication/AuthenticationController.coffee index 3fbad520c9..dfa19ed8a8 100644 --- a/services/web/app/coffee/Features/Authentication/AuthenticationController.coffee +++ b/services/web/app/coffee/Features/Authentication/AuthenticationController.coffee @@ -159,9 +159,7 @@ module.exports = AuthenticationController = return isValid _redirectToLoginOrRegisterPage: (req, res)-> - if (req.query.zipUrl? or - req.query.project_name? or - req.path == '/user/subscription/new') + if (req.query.zipUrl? or req.query.project_name? or req.path == '/user/subscription/new') return AuthenticationController._redirectToRegisterPage(req, res) else AuthenticationController._redirectToLoginPage(req, res) diff --git a/services/web/app/coffee/Features/HealthCheck/HealthCheckController.coffee b/services/web/app/coffee/Features/HealthCheck/HealthCheckController.coffee index 544933b5fc..489995559c 100644 --- a/services/web/app/coffee/Features/HealthCheck/HealthCheckController.coffee +++ b/services/web/app/coffee/Features/HealthCheck/HealthCheckController.coffee @@ -10,7 +10,7 @@ module.exports = HealthCheckController = check: (req, res, next = (error) ->) -> d = domain.create() d.on "error", (error) -> - logger.err err: error, "error in mocha" + logger.err err: error, "error in mocha" d.run () -> mocha = new Mocha(reporter: Reporter(res), timeout: 10000) mocha.addFile("test/smoke/js/SmokeTests.js") diff --git a/services/web/app/coffee/Features/User/UserController.coffee b/services/web/app/coffee/Features/User/UserController.coffee index c25b20a3a6..9b102d13dd 100644 --- a/services/web/app/coffee/Features/User/UserController.coffee +++ b/services/web/app/coffee/Features/User/UserController.coffee @@ -163,8 +163,8 @@ module.exports = UserController = logger.log user: user, "passwords do not match" res.send message: - type:'error' - text:'Your passwords do not match' + type:'error' + text:'Your passwords do not match' else logger.log user: user, "password changed" AuthenticationManager.setUserPassword user._id, newPassword1, (error) -> @@ -179,5 +179,5 @@ module.exports = UserController = logger.log user_id: user_id, "current password wrong" res.send message: - type:'error' - text:'Your old password is wrong' + type:'error' + text:'Your old password is wrong' diff --git a/services/web/test/unit/coffee/Authentication/AuthenticationControllerTests.coffee b/services/web/test/unit/coffee/Authentication/AuthenticationControllerTests.coffee index 1d8d8ab27d..f631dfe9a9 100644 --- a/services/web/test/unit/coffee/Authentication/AuthenticationControllerTests.coffee +++ b/services/web/test/unit/coffee/Authentication/AuthenticationControllerTests.coffee @@ -341,7 +341,7 @@ describe "AuthenticationController", -> _id:@user_id } } - } + } result = @AuthenticationController.getLoggedInUserId @req expect(result).to.equal @user_id diff --git a/services/web/test/unit/coffee/Exports/ExportsControllerTests.coffee b/services/web/test/unit/coffee/Exports/ExportsControllerTests.coffee index 7ec568cede..c14037d665 100644 --- a/services/web/test/unit/coffee/Exports/ExportsControllerTests.coffee +++ b/services/web/test/unit/coffee/Exports/ExportsControllerTests.coffee @@ -41,11 +41,11 @@ describe 'ExportsController', -> it 'should ask the handler to return the status of an export', (done) -> @handler.fetchExport = sinon.stub().yields( null, - "{\"id\":897, \"status_summary\":\"completed\"}") + "{\"id\":897, \"status_summary\":\"completed\"}") @req.params = {project_id: project_id, export_id: 897} @controller.exportStatus @req, send:(body) => expect(body).to.deep.equal {export_json: { - status_summary: 'completed', status_detail: undefined + status_summary: 'completed', status_detail: undefined }} done()