fix unit tests

This commit is contained in:
Brian Gough 2017-11-13 09:41:04 +00:00
parent 83e3312fd8
commit c8ad331551
2 changed files with 6 additions and 6 deletions

View file

@ -11,7 +11,7 @@ describe "DocumentUpdaterController", ->
@callback = sinon.stub()
@io = { "mock": "socket.io" }
@EditorUpdatesController = SandboxedModule.require modulePath, requires:
"logger-sharelatex": @logger = { error: sinon.stub(), log: sinon.stub() }
"logger-sharelatex": @logger = { error: sinon.stub(), log: sinon.stub(), warn: sinon.stub() }
"settings-sharelatex": @settings =
redis:
documentupdater:
@ -125,8 +125,8 @@ describe "DocumentUpdaterController", ->
clients: sinon.stub().returns(@clients)
@EditorUpdatesController._processErrorFromDocumentUpdater @io, @doc_id, "Something went wrong"
it "should log out an error", ->
@logger.error.called.should.equal true
it "should log a warning", ->
@logger.warn.called.should.equal true
it "should disconnect all clients in that document", ->
@io.sockets.clients.calledWith(@doc_id).should.equal true

View file

@ -32,7 +32,7 @@ describe 'WebsocketController', ->
"./DocumentUpdaterManager": @DocumentUpdaterManager = {}
"./ConnectedUsersManager": @ConnectedUsersManager = {}
"./WebsocketLoadBalancer": @WebsocketLoadBalancer = {}
"logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub() }
"logger-sharelatex": @logger = { log: sinon.stub(), error: sinon.stub(), warn: sinon.stub() }
"metrics-sharelatex": @metrics =
inc: sinon.stub()
set: sinon.stub()
@ -514,8 +514,8 @@ describe 'WebsocketController', ->
# it "should disconnect the client", ->
# @client.disconnect.called.should.equal true
it "should log an error", ->
@logger.error.called.should.equal true
it "should log a warning", ->
@logger.warn.called.should.equal true
it "should call the callback with the error", ->
@callback.calledWith(@error).should.equal true