1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-15 11:58:42 -05:00
denoland-deno/cli/tests/unit/kv_queue_test.ts
Raashid Anwar cac17267fb
fix(ext/kv): throw error if already closed (#21459)
If KV is closed and tries to listen queue should throw an error

closes #20991
2023-12-05 10:16:47 -08:00

13 lines
392 B
TypeScript

// 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");
}
});