summaryrefslogtreecommitdiff
path: root/cli/tests/unit
diff options
context:
space:
mode:
authorRaashid Anwar <raashid12anwar@gmail.com>2023-12-05 23:46:47 +0530
committerGitHub <noreply@github.com>2023-12-05 10:16:47 -0800
commitcac17267fbe83f25181c4f8503c01b92694c46be (patch)
tree213ee5a7a24f613455757f434fb501fe69f8ff6f /cli/tests/unit
parent4a9f42950140b36b1916ab0e0320d721223b1095 (diff)
fix(ext/kv): throw error if already closed (#21459)
If KV is closed and tries to listen queue should throw an error closes #20991
Diffstat (limited to 'cli/tests/unit')
-rw-r--r--cli/tests/unit/kv_queue_test.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/unit/kv_queue_test.ts b/cli/tests/unit/kv_queue_test.ts
new file mode 100644
index 000000000..86b9d21a8
--- /dev/null
+++ b/cli/tests/unit/kv_queue_test.ts
@@ -0,0 +1,13 @@
+// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
+import { assertEquals, assertFalse } from "./test_util.ts";
+
+Deno.test({}, async function queueTestDbClose() {
+ const db: Deno.Kv = await Deno.openKv(":memory:");
+ db.close();
+ try {
+ await db.listenQueue(() => {});
+ assertFalse(false);
+ } catch (e) {
+ assertEquals(e.message, "already closed");
+ }
+});