mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
update tests to assume packs are created
This commit is contained in:
@@ -37,7 +37,7 @@ describe "Appending doc ops to the history", ->
|
||||
done()
|
||||
|
||||
it "should insert the compressed op into mongo", ->
|
||||
expect(@updates[0].op).to.deep.equal [{
|
||||
expect(@updates[0].pack[0].op).to.deep.equal [{
|
||||
p: 3, i: "foo"
|
||||
}]
|
||||
|
||||
@@ -99,13 +99,13 @@ describe "Appending doc ops to the history", ->
|
||||
throw error if error?
|
||||
done()
|
||||
|
||||
it "should combine all the updates into one", ->
|
||||
expect(@updates[0].op).to.deep.equal [{
|
||||
p: 3, i: "foobar"
|
||||
it "should combine all the updates into one pack", ->
|
||||
expect(@updates[0].pack[1].op).to.deep.equal [{
|
||||
p: 6, i: "bar"
|
||||
}]
|
||||
|
||||
it "should insert the correct version number into mongo", ->
|
||||
expect(@updates[0].v).to.equal 8
|
||||
expect(@updates[0].v_end).to.equal 8
|
||||
|
||||
|
||||
describe "when the updates are far apart", ->
|
||||
@@ -129,11 +129,11 @@ describe "Appending doc ops to the history", ->
|
||||
throw error if error?
|
||||
done()
|
||||
|
||||
it "should keep the updates separate", ->
|
||||
expect(@updates[0].op).to.deep.equal [{
|
||||
it "should combine the updates into one pack", ->
|
||||
expect(@updates[0].pack[0].op).to.deep.equal [{
|
||||
p: 3, i: "foo"
|
||||
}]
|
||||
expect(@updates[1].op).to.deep.equal [{
|
||||
expect(@updates[0].pack[1].op).to.deep.equal [{
|
||||
p: 6, i: "bar"
|
||||
}]
|
||||
|
||||
@@ -160,10 +160,10 @@ describe "Appending doc ops to the history", ->
|
||||
done()
|
||||
|
||||
it "should concat the compressed op into mongo", ->
|
||||
expect(@updates[0].op).to.deep.equal @expectedOp
|
||||
expect(@updates[0].pack.length).to.deep.equal 3 # batch size is 100
|
||||
|
||||
it "should insert the correct version number into mongo", ->
|
||||
expect(@updates[0].v).to.equal 250
|
||||
expect(@updates[0].v_end).to.equal 250
|
||||
|
||||
|
||||
describe "when there are multiple ops in each update", ->
|
||||
@@ -188,16 +188,16 @@ describe "Appending doc ops to the history", ->
|
||||
done()
|
||||
|
||||
it "should insert the compressed ops into mongo", ->
|
||||
expect(@updates[0].op).to.deep.equal [{
|
||||
expect(@updates[0].pack[0].op).to.deep.equal [{
|
||||
p: 3, i: "foo"
|
||||
}]
|
||||
expect(@updates[1].op).to.deep.equal [{
|
||||
expect(@updates[0].pack[1].op).to.deep.equal [{
|
||||
p: 6, i: "bar"
|
||||
}]
|
||||
|
||||
it "should insert the correct version numbers into mongo", ->
|
||||
expect(@updates[0].v).to.equal 3
|
||||
expect(@updates[1].v).to.equal 4
|
||||
expect(@updates[0].pack[0].v).to.equal 3
|
||||
expect(@updates[0].pack[1].v).to.equal 4
|
||||
|
||||
describe "when there is a no-op update", ->
|
||||
before (done) ->
|
||||
@@ -221,17 +221,17 @@ describe "Appending doc ops to the history", ->
|
||||
done()
|
||||
|
||||
it "should insert the compressed no-op into mongo", ->
|
||||
expect(@updates[0].op).to.deep.equal []
|
||||
expect(@updates[0].pack[0].op).to.deep.equal []
|
||||
|
||||
|
||||
it "should insert the compressed next update into mongo", ->
|
||||
expect(@updates[1].op).to.deep.equal [{
|
||||
expect(@updates[0].pack[1].op).to.deep.equal [{
|
||||
p: 3, i: "foo"
|
||||
}]
|
||||
|
||||
it "should insert the correct version numbers into mongo", ->
|
||||
expect(@updates[0].v).to.equal 3
|
||||
expect(@updates[1].v).to.equal 4
|
||||
expect(@updates[0].pack[0].v).to.equal 3
|
||||
expect(@updates[0].pack[1].v).to.equal 4
|
||||
|
||||
describe "when the project has versioning enabled", ->
|
||||
before (done) ->
|
||||
|
||||
@@ -89,9 +89,10 @@ describe "Archiving updates", ->
|
||||
doc.lastVersion.should.equal 20
|
||||
done()
|
||||
|
||||
it "should store twenty doc changes in S3", (done) ->
|
||||
it "should store twenty doc changes in S3 in one pack", (done) ->
|
||||
TrackChangesClient.getS3Doc @project_id, @doc_id, (error, res, doc) =>
|
||||
doc.length.should.equal 20
|
||||
doc.length.should.equal 1
|
||||
doc[0].pack.length.should.equal 20
|
||||
done()
|
||||
|
||||
describe "unarchiving a doc's updates", ->
|
||||
@@ -103,7 +104,7 @@ describe "Archiving updates", ->
|
||||
it "should restore doc changes", (done) ->
|
||||
db.docHistory.count { doc_id: ObjectId(@doc_id) }, (error, count) ->
|
||||
throw error if error?
|
||||
count.should.equal 20
|
||||
count.should.equal 1
|
||||
done()
|
||||
|
||||
it "should remove doc marked as inS3", (done) ->
|
||||
|
||||
@@ -31,7 +31,7 @@ describe "Flushing updates", ->
|
||||
|
||||
it "should flush the op into mongo", (done) ->
|
||||
TrackChangesClient.getCompressedUpdates @doc_id, (error, updates) ->
|
||||
expect(updates[0].op).to.deep.equal [{
|
||||
expect(updates[0].pack[0].op).to.deep.equal [{
|
||||
p: 3, i: "f"
|
||||
}]
|
||||
done()
|
||||
|
||||
Reference in New Issue
Block a user