From 59085c1dddf8b60e1add82424f3e671e9f53ec0b Mon Sep 17 00:00:00 2001 From: James Allen Date: Mon, 22 May 2017 15:33:52 +0100 Subject: [PATCH] Add missing require stubs and remove console.logs in unit tests --- .../web/app/coffee/Features/Project/ProjectUpdateHandler.coffee | 1 - .../web/test/UnitTests/coffee/Project/ProjectLocatorTests.coffee | 1 - .../UnitTests/coffee/Project/ProjectUpdateHandlerTests.coffee | 1 + services/web/test/UnitTests/coffee/User/UserLocatorTests.coffee | 1 + .../UnitTests/coffee/User/UserRegistrationHandlerTests.coffee | 1 - 5 files changed, 2 insertions(+), 3 deletions(-) diff --git a/services/web/app/coffee/Features/Project/ProjectUpdateHandler.coffee b/services/web/app/coffee/Features/Project/ProjectUpdateHandler.coffee index 7738425c8e..ba3b3b6295 100644 --- a/services/web/app/coffee/Features/Project/ProjectUpdateHandler.coffee +++ b/services/web/app/coffee/Features/Project/ProjectUpdateHandler.coffee @@ -1,6 +1,5 @@ Project = require('../../models/Project').Project logger = require('logger-sharelatex') -Project = require("../../models/Project").Project module.exports = markAsUpdated : (project_id, callback)-> diff --git a/services/web/test/UnitTests/coffee/Project/ProjectLocatorTests.coffee b/services/web/test/UnitTests/coffee/Project/ProjectLocatorTests.coffee index 9257c2e83e..3d9808503b 100644 --- a/services/web/test/UnitTests/coffee/Project/ProjectLocatorTests.coffee +++ b/services/web/test/UnitTests/coffee/Project/ProjectLocatorTests.coffee @@ -70,7 +70,6 @@ describe 'ProjectLocator', -> it 'should give error if element could not be found', (done)-> @locator.findElement {project_id:project._id, element_id:"ddsd432nj42", type:"docs"}, (err, foundElement, path, parentFolder)-> - console.log err err.should.deep.equal new Errors.NotFoundError("entity not found") done() diff --git a/services/web/test/UnitTests/coffee/Project/ProjectUpdateHandlerTests.coffee b/services/web/test/UnitTests/coffee/Project/ProjectUpdateHandlerTests.coffee index 5922a027e3..a68a9be1f1 100644 --- a/services/web/test/UnitTests/coffee/Project/ProjectUpdateHandlerTests.coffee +++ b/services/web/test/UnitTests/coffee/Project/ProjectUpdateHandlerTests.coffee @@ -11,6 +11,7 @@ describe 'ProjectUpdateHandler', -> @ProjectModel.update = sinon.stub().callsArg(3) @handler = SandboxedModule.require modulePath, requires: '../../models/Project':{Project:@ProjectModel} + 'logger-sharelatex' : { log: sinon.stub() } describe 'marking a project as recently updated', -> it 'should send an update to mongo', (done)-> diff --git a/services/web/test/UnitTests/coffee/User/UserLocatorTests.coffee b/services/web/test/UnitTests/coffee/User/UserLocatorTests.coffee index 73c178f934..dc3fc84dfa 100644 --- a/services/web/test/UnitTests/coffee/User/UserLocatorTests.coffee +++ b/services/web/test/UnitTests/coffee/User/UserLocatorTests.coffee @@ -11,6 +11,7 @@ describe "UserLocator", -> @UserLocator = SandboxedModule.require modulePath, requires: "../../infrastructure/mongojs": db: @db = { users: {} } "metrics-sharelatex": timeAsyncMethod: sinon.stub() + 'logger-sharelatex' : { log: sinon.stub() } @db.users = findOne : sinon.stub().callsArgWith(1, null, @user) diff --git a/services/web/test/UnitTests/coffee/User/UserRegistrationHandlerTests.coffee b/services/web/test/UnitTests/coffee/User/UserRegistrationHandlerTests.coffee index c59b481dc5..d0b96da2de 100644 --- a/services/web/test/UnitTests/coffee/User/UserRegistrationHandlerTests.coffee +++ b/services/web/test/UnitTests/coffee/User/UserRegistrationHandlerTests.coffee @@ -96,7 +96,6 @@ describe "UserRegistrationHandler", -> it "should return email registered in the error if there is a non holdingAccount there", (done)-> @User.findOne.callsArgWith(1, null, @user = {holdingAccount:false}) @handler.registerNewUser @passingRequest, (err, user)=> - console.log err, user err.should.deep.equal new Error("EmailAlreadyRegistered") user.should.deep.equal @user done()