commit 83861a25156ce96428a382c11c56bab799513c30
parent 3e76afae1ed7e858ce39a806dee83c6edb275154
Author: Florian Dold <dold@taler.net>
Date: Thu, 3 Sep 2026 15:29:03 +0200
idb-bridge: test keys that end in a zero-terminated character
Diffstat:
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/packages/idb-bridge/src/util/key-storage.test.ts b/packages/idb-bridge/src/util/key-storage.test.ts
@@ -38,3 +38,14 @@ test("basics", (t) => {
checkKeySer(t, [1, 2, 3, 4]);
checkKeySer(t, [[[1], 3], [4]]);
});
+
+test("keys ending in a character whose encoding ends in a zero byte", (t) => {
+ // The serialized form drops trailing zero bytes; these characters
+ // end in one and must still round-trip when they are last.
+ checkKeySer(t, "一");
+ checkKeySer(t, "aſ");
+ checkKeySer(t, "x😀");
+ checkKeySer(t, ["a", "一"]);
+ checkKeySer(t, ["一", 1]);
+ checkKeySer(t, new Uint8Array([1, 0x7f]));
+});