refactor: proper Node polyfill directory iteration now that Deno supports this (#4783)

This commit is contained in:
Chris Knight 2020-04-16 20:45:30 +01:00 committed by GitHub
parent f2d1bc3af3
commit 1cd1f7de70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 36 deletions

View file

@ -90,6 +90,7 @@ test({
}
);
const thirdRead: Dirent | null = await dir.read();
const fourthRead: Dirent | null = await dir.read();
if (firstRead?.name === "foo.txt") {
assertEquals(secondRead?.name, "bar.txt");
@ -100,6 +101,7 @@ test({
}
assert(secondCallback);
assert(thirdRead === null);
assert(fourthRead === null);
} finally {
Deno.removeSync(testDir, { recursive: true });
}
@ -120,6 +122,7 @@ test({
const firstRead: Dirent | null = dir.readSync();
const secondRead: Dirent | null = dir.readSync();
const thirdRead: Dirent | null = dir.readSync();
const fourthRead: Dirent | null = dir.readSync();
if (firstRead?.name === "foo.txt") {
assertEquals(secondRead?.name, "bar.txt");
@ -129,6 +132,7 @@ test({
fail("File not found during read");
}
assert(thirdRead === null);
assert(fourthRead === null);
} finally {
Deno.removeSync(testDir, { recursive: true });
}