1
0
Fork 0
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:
Bartek Iwańczuk 2023-07-04 02:54:54 +02:00 committed by GitHub
parent 3c8bbc434d
commit cafbf0a7a1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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;
},
});