From b2e4448992512edc7e10cd88e6bbf3796548c807 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Wed, 26 Feb 2020 17:56:57 +0100 Subject: [PATCH] [misc] test/acceptance: ReceiveUpdateTests: test remotely sent update --- .../coffee/ReceiveUpdateTests.coffee | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee b/services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee index 4da68b76c5..da9ee0ca36 100644 --- a/services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee +++ b/services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee @@ -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"})