diff options
author | 2022-01-19 02:39:25 -0800 | |
---|---|---|
committer | 2022-01-19 02:39:25 -0800 | |
commit | 505e4b80fd4bb0ecd78b983f2e62a6ec37af3e45 (patch) | |
tree | 6e583eb7dfc2fbaec133417f06c85c7608604cc4 | |
parent | cd8d88716f63c9be12e5f06860a50787480a25cb (diff) | |
download | bun-505e4b80fd4bb0ecd78b983f2e62a6ec37af3e45.tar.gz bun-505e4b80fd4bb0ecd78b983f2e62a6ec37af3e45.tar.zst bun-505e4b80fd4bb0ecd78b983f2e62a6ec37af3e45.zip |
Update fs.test.js
-rw-r--r-- | integration/bunjs-only-snippets/fs.test.js | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/integration/bunjs-only-snippets/fs.test.js b/integration/bunjs-only-snippets/fs.test.js index 4fc5c9e91..513132450 100644 --- a/integration/bunjs-only-snippets/fs.test.js +++ b/integration/bunjs-only-snippets/fs.test.js @@ -1,17 +1,9 @@ import { describe, it, expect } from "bun:test"; -import { - mkdirSync, - existsSync, - readFileSync, - mkdtempSync, - writeFileSync, -} from "node:fs"; - -const tmp = mkdtempSync("fs-test"); +import { mkdirSync, existsSync, readFileSync, writeFileSync } from "node:fs"; describe("mkdirSync", () => { it("should create a directory", () => { - const tempdir = `${tmp}/1234/hi`; + const tempdir = `/tmp/fs.test.js/${Date.now()}/1234/hi`; expect(existsSync(tempdir)).toBe(false); expect(tempdir.includes(mkdirSync(tempdir, { recursive: true }))).toBe( true @@ -29,7 +21,9 @@ describe("readFileSync", () => { describe("writeFileSync", () => { it("works", () => { - const text = writeFileSync(`${tmp}/writeFileSync.txt`, "utf8"); - expect(text).toBe("File read successfully"); + const path = `/tmp/${Date.now()}.writeFileSync.txt`; + writeFileSync(path, "File written successfully", "utf8"); + + expect(readFileSync(path, "utf8")).toBe("File written successfully"); }); }); |