diff options
author | 2023-05-17 20:51:38 -0700 | |
---|---|---|
committer | 2023-05-17 20:51:38 -0700 | |
commit | 17c258eb34e0d392676a256f830123fc588d6230 (patch) | |
tree | 0f8ca3f3e1a75cb51fd29850b48f67e3f23af887 | |
parent | aacbef3cf99206aa15e71491c55aba7156fe2caf (diff) | |
download | bun-17c258eb34e0d392676a256f830123fc588d6230.tar.gz bun-17c258eb34e0d392676a256f830123fc588d6230.tar.zst bun-17c258eb34e0d392676a256f830123fc588d6230.zip |
Update fs.test.ts
-rw-r--r-- | test/js/node/fs/fs.test.ts | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/js/node/fs/fs.test.ts b/test/js/node/fs/fs.test.ts index 1edbfa11c..9eb4399b3 100644 --- a/test/js/node/fs/fs.test.ts +++ b/test/js/node/fs/fs.test.ts @@ -62,14 +62,17 @@ it("writeFileSync in append should not truncate the file", () => { it("writeFileSync NOT in append SHOULD truncate the file", () => { const path = join(tmpdir(), "writeFileSync-should-not-append-" + (Date.now() * 10000).toString(16)); - writeFileSync(path, "---BEGIN---"); - var str = "---BEGIN---"; - expect(readFileSync(path, "utf8")).toBe(str); - for (let i = 0; i < 10; i++) { - const line = "Line #" + i; - str = line; - writeFileSync(path, line); + + for (let options of [{ flag: "w" }, { flag: undefined }, {}, undefined]) { + writeFileSync(path, "---BEGIN---", options); + var str = "---BEGIN---"; expect(readFileSync(path, "utf8")).toBe(str); + for (let i = 0; i < 10; i++) { + const line = "Line #" + i; + str = line; + writeFileSync(path, line, options); + expect(readFileSync(path, "utf8")).toBe(str); + } } }); |