Add missing require stubs and remove console.logs in unit tests

This commit is contained in:
James Allen 2017-05-22 15:33:52 +01:00
parent 3105c6743e
commit 59085c1ddd
5 changed files with 2 additions and 3 deletions

View file

@ -1,6 +1,5 @@
Project = require('../../models/Project').Project
logger = require('logger-sharelatex')
Project = require("../../models/Project").Project
module.exports =
markAsUpdated : (project_id, callback)->

View file

@ -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()

View file

@ -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)->

View file

@ -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)

View file

@ -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()