1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-01-20 20:42:19 -05:00

fix(ext/node): deno test

This commit is contained in:
zhangyongsheng.dev__dcar 2025-01-15 16:52:37 +08:00
parent 27adf4c797
commit e250b23b73

View file

@ -300,3 +300,20 @@ Deno.test({
await fileHandle.close(); 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();
},
});