From 505e4b80fd4bb0ecd78b983f2e62a6ec37af3e45 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 19 Jan 2022 02:39:25 -0800 Subject: Update fs.test.js --- integration/bunjs-only-snippets/fs.test.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'integration/bunjs-only-snippets/fs.test.js') 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"); }); }); -- cgit v1.2.3