mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
tests: deflake _fs_read_test.ts (#19699)
Closes https://github.com/denoland/deno/issues/19632
This commit is contained in:
parent
3c8bbc434d
commit
cafbf0a7a1
1 changed files with 12 additions and 4 deletions
|
@ -160,15 +160,23 @@ Deno.test({
|
|||
Deno.test({
|
||||
name: "[std/node/fs] Read fs.read(fd, cb) signature",
|
||||
async fn() {
|
||||
const promise = deferred();
|
||||
const file = Deno.makeTempFileSync();
|
||||
Deno.writeTextFileSync(file, "hi deno");
|
||||
const fd = openSync(file, "r+");
|
||||
await read(fd, (err, bytesRead, data) => {
|
||||
assertEquals(err, null);
|
||||
assertStrictEquals(bytesRead, 7);
|
||||
assertStrictEquals(data?.byteLength, 16384);
|
||||
read(fd, (err, bytesRead, data) => {
|
||||
try {
|
||||
assertEquals(err, null);
|
||||
assertStrictEquals(bytesRead, 7);
|
||||
assertStrictEquals(data?.byteLength, 16384);
|
||||
} catch (e) {
|
||||
promise.reject(e);
|
||||
return;
|
||||
}
|
||||
promise.resolve();
|
||||
});
|
||||
closeSync(fd);
|
||||
await promise;
|
||||
},
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue