summaryrefslogtreecommitdiff
path: root/test/storage.test
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2024-10-03 21:08:17 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2024-10-05 10:10:48 +0200
commit6d0e67bfdf84d1dff16232d8e31147f6c0d11cdf (patch)
tree47aa9e054a196f01ddad8b6d2c567b8a71530ab7 /test/storage.test
parent6da54c629a25674982c4465e9d0da9bee819aa6c (diff)
Keep unknown items in local state
Changelog: Keep unknown items in local state
Diffstat (limited to 'test/storage.test')
-rw-r--r--test/storage.test47
1 files changed, 47 insertions, 0 deletions
diff --git a/test/storage.test b/test/storage.test
index 0369807..3d898b1 100644
--- a/test/storage.test
+++ b/test/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")