silverbullet/lib/plugos/syscalls/fs.deno.test.ts

19 lines
588 B
TypeScript
Raw Permalink Normal View History

2024-07-30 23:33:33 +08:00
import type { FileMeta } from "../../../plug-api/types.ts";
2024-07-30 23:24:17 +08:00
import { assert } from "@std/assert";
import fileSystemSyscalls from "./fs.deno.ts";
2024-10-11 21:52:37 +08:00
import { dirname, resolve } from "@std/path";
2024-11-14 04:08:24 +08:00
import { fileURLToPath } from "node:url";
Deno.test("Test FS operations", async () => {
2024-10-11 21:52:37 +08:00
const thisFolder = resolve(
2024-11-14 04:08:24 +08:00
dirname(fileURLToPath(new URL(import.meta.url))),
2023-01-23 01:53:14 +08:00
);
const syscalls = fileSystemSyscalls(thisFolder);
const allFiles: FileMeta[] = await syscalls["fs.listFiles"](
{},
thisFolder,
true,
);
assert(allFiles.find((f) => f.name === "fs.deno.test.ts"));
});