From de94b20c766cc4006338f12fba0ce19dbbb89251 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20Smr=C5=BE?= <roman.smrz@seznam.cz>
Date: Thu, 3 Oct 2024 21:08:17 +0200
Subject: (test) Keep unknown items in local state

Changelog: Keep unknown items in local state
---
 storage.test | 47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/storage.test b/storage.test
index 0369807..3d898b1 100644
--- a/storage.test
+++ b/storage.test
@@ -427,3 +427,50 @@ test SharedStateWatcher:
 		send "shared-state-wait $s2" to p2
 		expect /shared-state-wait $s1/ from p2
 		expect /shared-state-wait $s2/ from p2
+
+
+test LocalStateKeepUnknown:
+	let refpat = /blake2#[0-9a-f]*/
+
+	spawn as p
+	with p:
+		send "create-identity Device"
+		send "watch-local-identity"
+		expect /local-identity Device/
+
+		send "local-state-get"
+		expect /local-state-get ($refpat)/ capture s1
+		send "load $s1"
+
+		expect /load-type rec [0-9]*/
+		expect /load-line id:r ($refpat)/ capture id1
+		local:
+			expect /load-(.*)/ capture done
+			guard (done == "done")
+
+		send:
+			"store rec"
+			"id:r $id1"
+			"TEST:i 123"
+			""
+		expect /store-done ($refpat)/ capture s2
+		send "local-state-replace $s1 $s2"
+		expect /local-state-replace-done/
+
+		send "local-state-get"
+		expect /local-state-get $s2/
+
+		send "update-local-identity Device2"
+		expect /local-identity Device2/
+
+		send "local-state-get"
+		expect /local-state-get ($refpat)/ capture s3
+		send "load $s3"
+
+		expect /load-type rec [0-9]*/
+		expect /load-line id:r ($refpat)/ capture id2
+		guard (id1 /= id2)
+		expect /load-line TEST:i 123/
+		local:
+			expect /load-(.*)/ capture done
+			guard (done == "done")
-- 
cgit v1.2.3


From 49d91088e853167083aa6c9823adfe7a3cadb6c5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20Smr=C5=BE?= <roman.smrz@seznam.cz>
Date: Mon, 7 Oct 2024 22:17:40 +0200
Subject: (test) Handle unknown object type

Changelog: Handle unknown object type
---
 network.test | 41 +++++++++++++++++++++++++++++++++++++++++
 storage.test | 22 ++++++++++++++++++++++
 2 files changed, 63 insertions(+)

diff --git a/network.test b/network.test
index efd508f..6f16f7d 100644
--- a/network.test
+++ b/network.test
@@ -380,3 +380,44 @@ test Reconnection:
 					guard (done == "done")
 
 				expect /test-message-received blob [0-9]+ $message/
+
+
+test SendUnknownObjectType:
+	let refpat = /blake2#[0-9a-f]*/
+
+	spawn as p1
+	spawn as p2
+
+	with p1:
+		send "create-identity Device1"
+		send "start-server"
+	with p2:
+		send "create-identity Device2"
+		send "start-server"
+
+	expect from p1:
+		/peer 1 addr ${p2.node.ip} 29665/
+		/peer 1 id Device2/
+	expect from p2:
+		/peer 1 addr ${p1.node.ip} 29665/
+		/peer 1 id Device1/
+
+	with p1:
+		send:
+			"store test-unknown"
+			"TEST"
+			""
+		expect /store-done ($refpat)/ capture r1
+
+		send "test-message-send 1 $r1"
+		expect /test-message-send done/
+
+		with p2:
+			expect /test-message-received test-unknown [0-9]+ $r1/
+
+			send "load $r1"
+			expect /load-type test-unknown 5/
+			expect /load-line TEST/
+			local:
+				expect /load-(.*)/ capture done
+				guard (done == "done")
diff --git a/storage.test b/storage.test
index 3d898b1..2a53bb8 100644
--- a/storage.test
+++ b/storage.test
@@ -474,3 +474,25 @@ test LocalStateKeepUnknown:
 		local:
 			expect /load-(.*)/ capture done
 			guard (done == "done")
+
+
+test UnknownObjectType:
+	let refpat = /blake2#[0-9a-f]*/
+
+	spawn as p
+	spawn as p2 on p.node
+
+	with p:
+		send:
+			"store test-unknown"
+			"TEST"
+			""
+		expect /store-done ($refpat)/ capture r1
+
+		with p2:
+			send "load $r1"
+			expect /load-type test-unknown 5/
+			expect /load-line TEST/
+			local:
+				expect /load-(.*)/ capture done
+				guard (done == "done")
-- 
cgit v1.2.3


From 5ae58def2cd9e781af332a57266ae92385a6fb8b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20Smr=C5=BE?= <roman.smrz@seznam.cz>
Date: Wed, 9 Oct 2024 20:59:35 +0200
Subject: (test) Handle unknown record item types

Changelog: Handle unknown record item types
---
 network.test | 19 +++++++++++++++++++
 storage.test | 22 ++++++++++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/network.test b/network.test
index 6f16f7d..40190f4 100644
--- a/network.test
+++ b/network.test
@@ -409,6 +409,12 @@ test SendUnknownObjectType:
 			""
 		expect /store-done ($refpat)/ capture r1
 
+		send:
+			"store rec"
+			"test:unknown TEST"
+			""
+		expect /store-done ($refpat)/ capture r2
+
 		send "test-message-send 1 $r1"
 		expect /test-message-send done/
 
@@ -421,3 +427,16 @@ test SendUnknownObjectType:
 			local:
 				expect /load-(.*)/ capture done
 				guard (done == "done")
+
+		send "test-message-send 1 $r2"
+		expect /test-message-send done/
+
+		with p2:
+			expect /test-message-received rec [0-9]+ $r2/
+
+			send "load $r2"
+			expect /load-type rec [0-9]+/
+			expect /load-line test:unknown TEST/
+			local:
+				expect /load-(.*)/ capture done
+				guard (done == "done")
diff --git a/storage.test b/storage.test
index 2a53bb8..db9e0a1 100644
--- a/storage.test
+++ b/storage.test
@@ -496,3 +496,25 @@ test UnknownObjectType:
 			local:
 				expect /load-(.*)/ capture done
 				guard (done == "done")
+
+
+test UnknownRecordItemType:
+	let refpat = /blake2#[0-9a-f]*/
+
+	spawn as p
+	spawn as p2 on p.node
+
+	with p:
+		send:
+			"store rec"
+			"test:unknown TEST"
+			""
+		expect /store-done ($refpat)/ capture r1
+
+		with p2:
+			send "load $r1"
+			expect /load-type rec [0-9]+/
+			expect /load-line test:unknown TEST/
+			local:
+				expect /load-(.*)/ capture done
+				guard (done == "done")
-- 
cgit v1.2.3


From 3fbe5a872a25831b779135e8cc6849aede2288a6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20Smr=C5=BE?= <roman.smrz@seznam.cz>
Date: Sat, 12 Oct 2024 19:23:47 +0200
Subject: (test) Chatroom: unsubscribe when leaving

---
 chatroom.test | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/chatroom.test b/chatroom.test
index 93de1ff..deea2cb 100644
--- a/chatroom.test
+++ b/chatroom.test
@@ -413,9 +413,12 @@ test ChatroomMembers:
 	send "chatroom-leave $room1_p1" to p1
 	send "chatroom-leave $room1_p3" to p3
 
-	for p in [ p1, p2, p3 ]:
+	for p in [ p1, p2 ]:
 		with p:
 			expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner1 leave/
+
+	for p in [ p2, p3 ]:
+		with p:
 			expect /chatroom-message-new [a-z0-9#]+ room first_room from Owner3 leave/
 
 	send "chatroom-members $room1_p1" to p1
-- 
cgit v1.2.3


From 96cbafd34d35b0330505c73cb4a963b6e9cb030d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Roman=20Smr=C5=BE?= <roman.smrz@seznam.cz>
Date: Tue, 29 Oct 2024 20:19:46 +0100
Subject: (test) Chatroom-specific identity

Changelog: Chatroom-specific identity
---
 chatroom.test | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/chatroom.test b/chatroom.test
index deea2cb..4dda21e 100644
--- a/chatroom.test
+++ b/chatroom.test
@@ -429,3 +429,51 @@ test ChatroomMembers:
 			expect /chatroom-members-item Owner2/
 			expect /chatroom-members-([a-z]+)/ capture done
 			guard (done == "done")
+
+
+test ChatroomIdentity:
+	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 false/ from p2 capture room1_p2
+
+	send "chatroom-join-as $room1_p1 Custom1" to p1
+	expect /chatroom-join-as-done $room1_p1/ from p1
+	send "chatroom-join-as $room1_p2 Custom2" to p2
+	expect /chatroom-join-as-done $room1_p2/ from p2
+
+	send "chatroom-message-send $room1_p1 message1" to p1
+	send "chatroom-message-send $room1_p2 message2" to p2
+
+	for p in [ p1, p2 ]:
+		with p:
+			expect /chatroom-message-new [a-z0-9#]+ room first_room from ([^ ]+) text message1/ capture name1
+			guard (name1 == "Custom1")
+			expect /chatroom-message-new [a-z0-9#]+ room first_room from ([^ ]+) text message2/ capture name2
+			guard (name2 == "Custom2")
+
+	spawn as p1b on p1.node
+	spawn as p2b on p2.node
+	for p in [ p1b, p2b ]:
+		with p:
+			send "chatroom-watch-local"
+
+	send "chatroom-message-send $room1_p1 message3" to p1b
+	send "chatroom-message-send $room1_p2 message4" to p2b
+
+	for p in [ p1, p2, p1b, p2b ]:
+		with p:
+			expect /chatroom-message-new [a-z0-9#]+ room first_room from ([^ ]+) text message3/ capture name1
+			guard (name1 == "Custom1")
+			expect /chatroom-message-new [a-z0-9#]+ room first_room from ([^ ]+) text message4/ capture name2
+			guard (name2 == "Custom2")
-- 
cgit v1.2.3