|
@@ -19,6 +19,9 @@ describe "RealTimeRedisManager", ->
|
|
|
key_schema:
|
|
key_schema:
|
|
|
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
|
|
pendingUpdates: ({doc_id}) -> "PendingUpdates:#{doc_id}"
|
|
|
"logger-sharelatex": { log: () -> }
|
|
"logger-sharelatex": { log: () -> }
|
|
|
|
|
+ "crypto": @crypto = { randomBytes: sinon.stub().withArgs(4).returns(Buffer.from([0x1, 0x2, 0x3, 0x4])) }
|
|
|
|
|
+ "os": @os = {hostname: sinon.stub().returns("somehost")}
|
|
|
|
|
+
|
|
|
@doc_id = "doc-id-123"
|
|
@doc_id = "doc-id-123"
|
|
|
@project_id = "project-id-123"
|
|
@project_id = "project-id-123"
|
|
|
@callback = sinon.stub()
|
|
@callback = sinon.stub()
|
|
@@ -74,3 +77,12 @@ describe "RealTimeRedisManager", ->
|
|
|
|
|
|
|
|
it "should return the length", ->
|
|
it "should return the length", ->
|
|
|
@callback.calledWith(null, @length).should.equal true
|
|
@callback.calledWith(null, @length).should.equal true
|
|
|
|
|
+
|
|
|
|
|
+ describe "sendData", ->
|
|
|
|
|
+ beforeEach ->
|
|
|
|
|
+ @message_id = "doc:somehost:01020304-0"
|
|
|
|
|
+ @rclient.publish = sinon.stub()
|
|
|
|
|
+ @RealTimeRedisManager.sendData({op: "thisop"})
|
|
|
|
|
+
|
|
|
|
|
+ it "should send the op with a message id", ->
|
|
|
|
|
+ @rclient.publish.calledWith("applied-ops", JSON.stringify({op:"thisop",_id:@message_id})).should.equal true
|