aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-17 20:51:38 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-05-17 20:51:38 -0700
commit17c258eb34e0d392676a256f830123fc588d6230 (patch)
tree0f8ca3f3e1a75cb51fd29850b48f67e3f23af887
parentaacbef3cf99206aa15e71491c55aba7156fe2caf (diff)
downloadbun-17c258eb34e0d392676a256f830123fc588d6230.tar.gz
bun-17c258eb34e0d392676a256f830123fc588d6230.tar.zst
bun-17c258eb34e0d392676a256f830123fc588d6230.zip
Update fs.test.ts
-rw-r--r--test/js/node/fs/fs.test.ts17
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);
+ }
}
});