aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
+ }
}
});