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";
|
2022-10-19 17:30:22 +08:00
|
|
|
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";
|
2022-10-19 17:30:22 +08:00
|
|
|
|
|
|
|
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
|
|
|
);
|
2022-10-19 17:30:22 +08:00
|
|
|
const syscalls = fileSystemSyscalls(thisFolder);
|
|
|
|
const allFiles: FileMeta[] = await syscalls["fs.listFiles"](
|
2024-01-15 23:43:12 +08:00
|
|
|
{},
|
2022-10-19 17:30:22 +08:00
|
|
|
thisFolder,
|
|
|
|
true,
|
|
|
|
);
|
|
|
|
assert(allFiles.find((f) => f.name === "fs.deno.test.ts"));
|
|
|
|
});
|