From 15f7d82c37cb1b0e12a1eade91e0db2e132d4c60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 26 Jun 2024 22:40:20 +0200 Subject: Subscribe flag in chatroom state --- test/chatroom.test | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/chatroom.test b/test/chatroom.test index ffb7b4d..9be5665 100644 --- a/test/chatroom.test +++ b/test/chatroom.test @@ -10,8 +10,8 @@ test ChatroomSetup: send "chatroom-list-local" - expect /chatroom-list-item ([a-z0-9#]+) first/ capture first - expect /chatroom-list-item [a-z0-9#]+ second/ + expect /chatroom-list-item ([a-z0-9#]+) first sub true/ capture first + expect /chatroom-list-item [a-z0-9#]+ second sub true/ local: expect /chatroom-list-(.*)/ capture done guard (done == "done") @@ -34,17 +34,38 @@ test ChatroomSetup: for p in [ p2, p3 ]: with p: - expect /chatroom-watched-added [a-z0-9#]+ first/ - expect /chatroom-watched-added [a-z0-9#]+ second/ + expect /chatroom-watched-added [a-z0-9#]+ first sub false/ + expect /chatroom-watched-added [a-z0-9#]+ second sub false/ + + # Subscribe and unsubscribe + + with p1: + send "chatroom-unsubscribe $first" + expect /chatroom-watched-updated [a-z0-9#]+ first sub false .*/ + + send "chatroom-subscribe $first" + expect /chatroom-watched-updated [a-z0-9#]+ first sub true .*/ with p2: send "chatroom-list-local" - expect /chatroom-list-item [a-z0-9#]+ first/ - expect /chatroom-list-item [a-z0-9#]+ second/ + expect /chatroom-list-item ([a-z0-9#]+) first sub false/ capture p2_first + expect /chatroom-list-item ([a-z0-9#]+) second sub false/ capture p2_second local: expect /chatroom-list-(.*)/ capture done guard (done == "done") + send "chatroom-subscribe $p2_first" + send "chatroom-subscribe $p2_second" + + expect /chatroom-watched-updated [a-z0-9#]+ first sub true .*/ + expect /chatroom-watched-updated [a-z0-9#]+ second sub true .*/ + + send "chatroom-unsubscribe $p2_first" + send "chatroom-unsubscribe $p2_second" + + expect /chatroom-watched-updated [a-z0-9#]+ first sub false .*/ + expect /chatroom-watched-updated [a-z0-9#]+ second sub false .*/ + # Create and sync additional chatrooms send "chatroom-create third" to p1 @@ -56,9 +77,9 @@ test ChatroomSetup: for p in [ p1, p2, p3 ]: with p: - expect /chatroom-watched-added [a-z0-9#]+ third/ - expect /chatroom-watched-added [a-z0-9#]+ fourth/ - expect /chatroom-watched-added [a-z0-9#]+ fifth/ + expect /chatroom-watched-added [a-z0-9#]+ third sub [a-z]+/ + expect /chatroom-watched-added [a-z0-9#]+ fourth sub [a-z]+/ + expect /chatroom-watched-added [a-z0-9#]+ fifth sub [a-z]+/ # Update chatroom name @@ -90,7 +111,7 @@ test ChatroomMessages: for p in [ p1 ]: with p: - expect /chatroom-watched-added $room room/ + expect /chatroom-watched-added [a-z0-9#]+ room sub [a-z]+/ send "chatroom-message-send $room message1" to p1 expect /chatroom-message-new $room from Owner1 text message1/ from p1 -- cgit v1.2.3