Просмотр исходного кода

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

Jakob Ackermann 6 лет назад
Родитель
Сommit
b2e4448992
1 измененных файлов с 23 добавлено и 0 удалено
  1. 23 0
      services/real-time/test/acceptance/coffee/ReceiveUpdateTests.coffee

+ 23 - 0
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"})