summaryrefslogtreecommitdiff
path: root/cli
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
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')
-rw-r--r--cli/tests/integration/js_unit_tests.rs1
-rw-r--r--cli/tests/unit/kv_queue_test.ts13
2 files changed, 14 insertions, 0 deletions
diff --git a/cli/tests/integration/js_unit_tests.rs b/cli/tests/integration/js_unit_tests.rs
index d4a56b63e..bdab48926 100644
--- a/cli/tests/integration/js_unit_tests.rs
+++ b/cli/tests/integration/js_unit_tests.rs
@@ -48,6 +48,7 @@ util::unit_test_factory!(
jupyter_test,
kv_test,
kv_queue_test_no_db_close,
+ kv_queue_test,
kv_queue_undelivered_test,
link_test,
make_temp_test,
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");
+ }
+});