Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lifegpc committed Jan 21, 2024
1 parent 4d886cb commit c91cba9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db_test.ts
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
6 changes: 6 additions & 0 deletions test_base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}

0 comments on commit c91cba9

Please sign in to comment.