From c91cba9014af7674567810ba96126435704ba7df Mon Sep 17 00:00:00 2001 From: lifegpc Date: Sun, 21 Jan 2024 20:40:15 +0800 Subject: [PATCH] Fix test --- db_test.ts | 4 ++-- test_base.ts | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/db_test.ts b/db_test.ts index ef8c057..3d84f4a 100644 --- a/db_test.ts +++ b/db_test.ts @@ -1,10 +1,10 @@ import { assertEquals } from "std/assert/mod.ts"; import { EhDb, EhFile, GMeta, PMeta } from "./db.ts"; import { TaskType } from "./task.ts"; -import { remove_if_exists } from "./test_base.ts"; +import { DB_PERMISSION, remove_if_exists } from "./test_base.ts"; import { sure_dir } from "./utils.ts"; -Deno.test("DbTest", async () => { +Deno.test({ name: "DbTest", permissions: DB_PERMISSION }, async () => { await sure_dir("./test/db"); await remove_if_exists("./test/db/data.db"); const db = new EhDb("./test/db"); diff --git a/test_base.ts b/test_base.ts index 186c98f..ea4e871 100644 --- a/test_base.ts +++ b/test_base.ts @@ -10,6 +10,12 @@ export const API_PERMISSION: Deno.PermissionOptions = { ], }; +export const DB_PERMISSION: Deno.PermissionOptions = { + env: ["DB_USE_FFI"], + read: ["./test"], + write: ["./test"], +}; + export async function remove_if_exists(f: string) { if (await exists(f)) await Deno.remove(f, { "recursive": true }); }