summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/unit/kv_test.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/cli/tests/unit/kv_test.ts b/cli/tests/unit/kv_test.ts
index 7bb4656c1..c50e52c52 100644
--- a/cli/tests/unit/kv_test.ts
+++ b/cli/tests/unit/kv_test.ts
@@ -7,6 +7,32 @@ import {
assertThrows,
} from "./test_util.ts";
+Deno.test({
+ name: "openKv :memory: no permissions",
+ permissions: {},
+ async fn() {
+ const db = await Deno.openKv(":memory:");
+ await db.close();
+ },
+});
+
+Deno.test({
+ name: "openKv invalid filenames",
+ permissions: {},
+ async fn() {
+ await assertRejects(
+ async () => await Deno.openKv(""),
+ TypeError,
+ "Filename cannot be empty",
+ );
+ await assertRejects(
+ async () => await Deno.openKv(":foo"),
+ TypeError,
+ "Filename cannot start with ':' unless prefixed with './'",
+ );
+ },
+});
+
function dbTest(name: string, fn: (db: Deno.Kv) => Promise<void>) {
Deno.test({
name,