mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add missing require stubs and remove console.logs in unit tests
This commit is contained in:
parent
3105c6743e
commit
59085c1ddd
5 changed files with 2 additions and 3 deletions
|
@ -1,6 +1,5 @@
|
||||||
Project = require('../../models/Project').Project
|
Project = require('../../models/Project').Project
|
||||||
logger = require('logger-sharelatex')
|
logger = require('logger-sharelatex')
|
||||||
Project = require("../../models/Project").Project
|
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
markAsUpdated : (project_id, callback)->
|
markAsUpdated : (project_id, callback)->
|
||||||
|
|
|
@ -70,7 +70,6 @@ describe 'ProjectLocator', ->
|
||||||
|
|
||||||
it 'should give error if element could not be found', (done)->
|
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)->
|
@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")
|
err.should.deep.equal new Errors.NotFoundError("entity not found")
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe 'ProjectUpdateHandler', ->
|
||||||
@ProjectModel.update = sinon.stub().callsArg(3)
|
@ProjectModel.update = sinon.stub().callsArg(3)
|
||||||
@handler = SandboxedModule.require modulePath, requires:
|
@handler = SandboxedModule.require modulePath, requires:
|
||||||
'../../models/Project':{Project:@ProjectModel}
|
'../../models/Project':{Project:@ProjectModel}
|
||||||
|
'logger-sharelatex' : { log: sinon.stub() }
|
||||||
|
|
||||||
describe 'marking a project as recently updated', ->
|
describe 'marking a project as recently updated', ->
|
||||||
it 'should send an update to mongo', (done)->
|
it 'should send an update to mongo', (done)->
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe "UserLocator", ->
|
||||||
@UserLocator = SandboxedModule.require modulePath, requires:
|
@UserLocator = SandboxedModule.require modulePath, requires:
|
||||||
"../../infrastructure/mongojs": db: @db = { users: {} }
|
"../../infrastructure/mongojs": db: @db = { users: {} }
|
||||||
"metrics-sharelatex": timeAsyncMethod: sinon.stub()
|
"metrics-sharelatex": timeAsyncMethod: sinon.stub()
|
||||||
|
'logger-sharelatex' : { log: sinon.stub() }
|
||||||
@db.users =
|
@db.users =
|
||||||
findOne : sinon.stub().callsArgWith(1, null, @user)
|
findOne : sinon.stub().callsArgWith(1, null, @user)
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,6 @@ describe "UserRegistrationHandler", ->
|
||||||
it "should return email registered in the error if there is a non holdingAccount there", (done)->
|
it "should return email registered in the error if there is a non holdingAccount there", (done)->
|
||||||
@User.findOne.callsArgWith(1, null, @user = {holdingAccount:false})
|
@User.findOne.callsArgWith(1, null, @user = {holdingAccount:false})
|
||||||
@handler.registerNewUser @passingRequest, (err, user)=>
|
@handler.registerNewUser @passingRequest, (err, user)=>
|
||||||
console.log err, user
|
|
||||||
err.should.deep.equal new Error("EmailAlreadyRegistered")
|
err.should.deep.equal new Error("EmailAlreadyRegistered")
|
||||||
user.should.deep.equal @user
|
user.should.deep.equal @user
|
||||||
done()
|
done()
|
||||||
|
|
Loading…
Reference in a new issue