mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Fix unit tests
This commit is contained in:
@@ -18,11 +18,11 @@ module.exports = EditorUpdatesController =
|
||||
if takeSnapshot
|
||||
AutomaticSnapshotManager.markProjectAsUpdated(project_id)
|
||||
|
||||
logger.log doc_id: doc_id, project_id: project_id, client_id: update.meta.source, version: update.v, "sending update to doc updater"
|
||||
logger.log doc_id: doc_id, project_id: project_id, client_id: update.meta?.source, version: update.v, "sending update to doc updater"
|
||||
|
||||
DocumentUpdaterHandler.queueChange project_id, doc_id, update, (error) ->
|
||||
if error?
|
||||
logger.error err:error, project_id: project_id, doc_id: doc_id, client_id: update.meta.source, version: update.v, "document was not available for update"
|
||||
logger.error err:error, project_id: project_id, doc_id: doc_id, client_id: update.meta?.source, version: update.v, "document was not available for update"
|
||||
client.disconnect()
|
||||
callback(error)
|
||||
|
||||
@@ -52,7 +52,7 @@ module.exports = EditorUpdatesController =
|
||||
|
||||
_applyUpdateFromDocumentUpdater: (doc_id, update) ->
|
||||
io = require('../../infrastructure/Server').io
|
||||
logger.log doc_id: doc_id, version: update.v, source: update.meta.source, "distributing update"
|
||||
logger.log doc_id: doc_id, version: update.v, source: update.meta?.source, "distributing update"
|
||||
for client in io.sockets.clients(doc_id)
|
||||
if client.id == update.meta.source
|
||||
client.emit "otUpdateApplied", v: update.v, doc: update.doc
|
||||
|
||||
@@ -12,7 +12,7 @@ describe "EditorUpdatesController", ->
|
||||
@client = new MockClient()
|
||||
@callback = sinon.stub()
|
||||
@EditorUpdatesController = SandboxedModule.require modulePath, requires:
|
||||
"logger-sharelatex": @logger = { error: sinon.stub() }
|
||||
"logger-sharelatex": @logger = { error: sinon.stub(), log: sinon.stub() }
|
||||
"./EditorRealTimeController" : @EditorRealTimeController = {}
|
||||
"../DocumentUpdater/DocumentUpdaterHandler" : @DocumentUpdaterHandler = {}
|
||||
"../Versioning/AutomaticSnapshotManager" : @AutomaticSnapshotManager = {}
|
||||
|
||||
Reference in New Issue
Block a user