diff options
Diffstat (limited to 'test/bun.js/fs.test.js')
-rw-r--r-- | test/bun.js/fs.test.js | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/bun.js/fs.test.js b/test/bun.js/fs.test.js index 3d8a7978a..1a5ba24d4 100644 --- a/test/bun.js/fs.test.js +++ b/test/bun.js/fs.test.js @@ -17,6 +17,7 @@ import { rmSync, createReadStream, createWriteStream, + promises, } from "node:fs"; import { join } from "node:path"; @@ -540,3 +541,18 @@ describe("createWriteStream", () => { }); }); }); + +describe("fs/promises", () => { + const { readFile, writeFile } = promises; + + it("readFile", async () => { + const data = await readFile(import.meta.dir + "/readFileSync.txt", "utf8"); + expect(data).toBe("File read successfully"); + }); + + it("writeFile", async () => { + const path = `/tmp/fs.test.js/${Date.now()}.writeFile.txt`; + await writeFile(path, "File written successfully"); + expect(readFileSync(path, "utf8")).toBe("File written successfully"); + }); +}); |