2023-08-20 15:51:00 +00:00
|
|
|
import { FileMeta } from "$sb/types.ts";
|
2022-10-19 09:30:22 +00:00
|
|
|
import { assert } from "../../test_deps.ts";
|
|
|
|
import { path } from "../deps.ts";
|
|
|
|
import fileSystemSyscalls from "./fs.deno.ts";
|
|
|
|
|
|
|
|
const fakeCtx = {} as any;
|
|
|
|
|
|
|
|
Deno.test("Test FS operations", async () => {
|
2023-01-22 17:53:14 +00:00
|
|
|
const thisFolder = path.resolve(
|
2023-05-23 18:53:53 +00:00
|
|
|
path.dirname(new URL(import.meta.url).pathname),
|
2023-01-22 17:53:14 +00:00
|
|
|
);
|
2022-10-19 09:30:22 +00:00
|
|
|
const syscalls = fileSystemSyscalls(thisFolder);
|
|
|
|
const allFiles: FileMeta[] = await syscalls["fs.listFiles"](
|
|
|
|
fakeCtx,
|
|
|
|
thisFolder,
|
|
|
|
true,
|
|
|
|
);
|
|
|
|
assert(allFiles.find((f) => f.name === "fs.deno.test.ts"));
|
|
|
|
});
|