summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/tests/unit/kv_test.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/cli/tests/unit/kv_test.ts b/cli/tests/unit/kv_test.ts
index 28c913f21..4963882e1 100644
--- a/cli/tests/unit/kv_test.ts
+++ b/cli/tests/unit/kv_test.ts
@@ -2248,3 +2248,23 @@ dbTest("set with key versionstamp suffix", async (db) => {
"expected string, number, bigint, ArrayBufferView, boolean",
);
});
+
+Deno.test({
+ name: "watch should stop when db closed",
+ async fn() {
+ const db = await Deno.openKv(":memory:");
+
+ const watch = db.watch([["a"]]);
+ const completion = (async () => {
+ for await (const _item of watch) {
+ // pass
+ }
+ })();
+
+ setTimeout(() => {
+ db.close();
+ }, 100);
+
+ await completion;
+ },
+});