[misc] test/acceptance: ReceiveUpdateTests: test remotely sent update

This commit is contained in:
Jakob Ackermann 2020-02-26 17:56:57 +01:00 committed by Jakob Ackermann
parent 83e3ff0ed7
commit b2e4448992

View file

@ -146,6 +146,29 @@ describe "receiveUpdate", ->
v: @version, doc: @doc_id_second
}]
describe "with an update from a remote client for project 1", ->
beforeEach (done) ->
@update = {
doc_id: @doc_id
op:
meta:
source: 'this-is-a-remote-client-id'
v: @version
doc: @doc_id
op: [{i: "foo", p: 50}]
}
rclient.publish "applied-ops", JSON.stringify(@update)
setTimeout done, 200 # Give clients time to get message
it "should send the full op to clientA", ->
@clientAUpdates.should.deep.equal [@update.op]
it "should send the full op to clientB", ->
@clientBUpdates.should.deep.equal [@update.op]
it "should send nothing to clientC", ->
@clientCUpdates.should.deep.equal []
describe "with an error for the first project", ->
beforeEach (done) ->
rclient.publish "applied-ops", JSON.stringify({doc_id: @doc_id, error: @error = "something went wrong"})