mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Fix UpdateManager tests
This commit is contained in:
parent
ce93a76e7f
commit
f43355b74d
1 changed files with 15 additions and 4 deletions
|
@ -157,9 +157,15 @@ describe "UpdateManager", ->
|
||||||
@update = {op: [{p: 42, i: "foo"}]}
|
@update = {op: [{p: 42, i: "foo"}]}
|
||||||
@updatedDocLines = ["updated", "lines"]
|
@updatedDocLines = ["updated", "lines"]
|
||||||
@version = 34
|
@version = 34
|
||||||
|
@lines = ["original", "lines"]
|
||||||
|
@track_changes_on = true
|
||||||
|
@track_changes_entries = { entries: "mock", comments: "mock" }
|
||||||
|
@updated_track_changes_entries = { entries: "updated", comments: "updated" }
|
||||||
@appliedOps = ["mock-applied-ops"]
|
@appliedOps = ["mock-applied-ops"]
|
||||||
@ShareJsUpdateManager.applyUpdate = sinon.stub().callsArgWith(3, null, @updatedDocLines, @version, @appliedOps)
|
@DocumentManager.getDoc = sinon.stub().yields(null, @lines, @version, @track_changes_on, @track_changes_entries)
|
||||||
@RedisManager.updateDocument = sinon.stub().callsArg(4)
|
@TrackChangesManager.applyUpdate = sinon.stub().yields(null, @updated_track_changes_entries)
|
||||||
|
@ShareJsUpdateManager.applyUpdate = sinon.stub().yields(null, @updatedDocLines, @version, @appliedOps)
|
||||||
|
@RedisManager.updateDocument = sinon.stub().yields()
|
||||||
@HistoryManager.pushUncompressedHistoryOps = sinon.stub().callsArg(3)
|
@HistoryManager.pushUncompressedHistoryOps = sinon.stub().callsArg(3)
|
||||||
|
|
||||||
describe "normally", ->
|
describe "normally", ->
|
||||||
|
@ -168,12 +174,17 @@ describe "UpdateManager", ->
|
||||||
|
|
||||||
it "should apply the updates via ShareJS", ->
|
it "should apply the updates via ShareJS", ->
|
||||||
@ShareJsUpdateManager.applyUpdate
|
@ShareJsUpdateManager.applyUpdate
|
||||||
.calledWith(@project_id, @doc_id, @update)
|
.calledWith(@project_id, @doc_id, @update, @lines, @version)
|
||||||
|
.should.equal true
|
||||||
|
|
||||||
|
it "should update the track changes entries", ->
|
||||||
|
@TrackChangesManager.applyUpdate
|
||||||
|
.calledWith(@project_id, @doc_id, @track_changes_entries, @appliedOps, @track_changes_on)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should save the document", ->
|
it "should save the document", ->
|
||||||
@RedisManager.updateDocument
|
@RedisManager.updateDocument
|
||||||
.calledWith(@doc_id, @updatedDocLines, @version, @appliedOps)
|
.calledWith(@doc_id, @updatedDocLines, @version, @appliedOps, @updated_track_changes_entries)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should push the applied ops into the track changes queue", ->
|
it "should push the applied ops into the track changes queue", ->
|
Loading…
Reference in a new issue