1
0
silverbullet/plugos/syscalls/fs.deno.test.ts

19 lines
610 B
TypeScript
Raw Normal View History

import { assert } from "../../test_deps.ts";
import { FileMeta } from "../../common/types.ts";
import { path } from "../deps.ts";
import fileSystemSyscalls from "./fs.deno.ts";
2023-01-01 19:28:25 +00:00
import { urlToPathname } from "../util.ts";
const fakeCtx = {} as any;
Deno.test("Test FS operations", async () => {
2023-01-01 19:28:25 +00:00
const thisFolder = path.resolve(path.dirname(urlToPathname(new URL(import.meta.url))));
const syscalls = fileSystemSyscalls(thisFolder);
const allFiles: FileMeta[] = await syscalls["fs.listFiles"](
fakeCtx,
thisFolder,
true,
);
assert(allFiles.find((f) => f.name === "fs.deno.test.ts"));
});