summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-07-15 22:47:31 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2024-07-16 20:29:19 +0200
commitc946dea60c6a9121a8b8af766c654b81170a13a2 (patch)
treea59b04317f6f395f5f09fa5bdcd1c1c3e748136d
parent888ca65103987bdd745ed11099031fbbec68a485 (diff)
(test) Send current chatroom subscriptions to new peers
-rw-r--r--chatroom.test41
1 files changed, 41 insertions, 0 deletions
diff --git a/chatroom.test b/chatroom.test
index c4cdc6d..9b68839 100644
--- a/chatroom.test
+++ b/chatroom.test
@@ -239,3 +239,44 @@ test ChatroomMessages:
expect /chatroom-message-new [a-z0-9#]+ room ([a-z_]+) from Owner2 text ([a-z0-9_]+)/ capture room, message
guard (room == "third_room")
guard (message == "msg_r3_4")
+
+
+test ChatroomSubscribedBeforeStart:
+ spawn as p1
+ spawn as p2
+
+ send "create-identity Device1 Owner1" to p1
+ send "create-identity Device2 Owner2" to p2
+
+ for p in [ p1, p2 ]:
+ with p:
+ send "chatroom-watch-local"
+ send "start-server"
+
+ send "chatroom-create first_room" to p1
+ expect /chatroom-create-done ([a-z0-9#]+) first_room.*/ from p1 capture room1_p1
+
+ expect /chatroom-watched-added [a-z0-9#]+ first_room sub true/ from p1
+ expect /chatroom-watched-added ([a-z0-9#]+) first_room sub false/ from p2 capture room1_p2
+
+ with p2:
+ send "chatroom-subscribe $room1_p2"
+ expect /chatroom-watched-updated [a-z0-9#]+ first_room sub true .*/
+
+ for p in [p1, p2]:
+ with p:
+ send "stop-server"
+ for p in [p1, p2]:
+ with p:
+ expect /stop-server-done/
+ for p in [p1, p2]:
+ with p:
+ send "start-server"
+
+ send "chatroom-message-send $room1_p1 message1" to p1
+ expect /chatroom-message-new $room1_p1 room first_room from Owner1 text message1/ from p1
+ expect /chatroom-message-new $room1_p2 room first_room from Owner1 text message1/ from p2
+
+ send "chatroom-message-send $room1_p2 message2" to p2
+ expect /chatroom-message-new $room1_p1 room first_room from Owner2 text message2/ from p1
+ expect /chatroom-message-new $room1_p2 room first_room from Owner2 text message2/ from p2