Skip to content

Commit

Permalink
fix(ext/node): deno test
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYSzys committed Jan 15, 2025
1 parent 27adf4c commit e250b23
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/unit_node/_fs/_fs_handle_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,3 +300,20 @@ Deno.test({
await fileHandle.close();
},
});

Deno.test({
name:
"[node/fs filehandle.sync] Request that all data for the open file descriptor is flushed to the storage device",
async fn() {
const fileHandle = await fs.open(testData, "r+");

await fileHandle.datasync();
await fileHandle.sync();
const buf = Buffer.from("hello world");
await fileHandle.write(buf);
const ret = await fileHandle.read(Buffer.alloc(11), 0, 11, 0);
assertEquals(ret.bytesRead, 11);
assertEquals(ret.buffer, buf);
await fileHandle.close();
},
});

0 comments on commit e250b23

Please sign in to comment.