summaryrefslogtreecommitdiff
path: root/cli/tests/unit/read_dir_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/read_dir_test.ts')
-rw-r--r--cli/tests/unit/read_dir_test.ts26
1 files changed, 10 insertions, 16 deletions
diff --git a/cli/tests/unit/read_dir_test.ts b/cli/tests/unit/read_dir_test.ts
index 829f7bfa2..2e4370153 100644
--- a/cli/tests/unit/read_dir_test.ts
+++ b/cli/tests/unit/read_dir_test.ts
@@ -8,7 +8,7 @@ import {
unitTest,
} from "./test_util.ts";
-function assertSameContent(files: Deno.DirEntry[]): void {
+function assertSameContent(files: Deno.DirEntry[]) {
let counter = 0;
for (const entry of files) {
@@ -21,37 +21,35 @@ function assertSameContent(files: Deno.DirEntry[]): void {
assertEquals(counter, 1);
}
-unitTest({ perms: { read: true } }, function readDirSyncSuccess(): void {
+unitTest({ perms: { read: true } }, function readDirSyncSuccess() {
const files = [...Deno.readDirSync("cli/tests/")];
assertSameContent(files);
});
-unitTest({ perms: { read: true } }, function readDirSyncWithUrl(): void {
+unitTest({ perms: { read: true } }, function readDirSyncWithUrl() {
const files = [...Deno.readDirSync(pathToAbsoluteFileUrl("cli/tests"))];
assertSameContent(files);
});
-unitTest({ perms: { read: false } }, function readDirSyncPerm(): void {
+unitTest({ perms: { read: false } }, function readDirSyncPerm() {
assertThrows(() => {
Deno.readDirSync("tests/");
}, Deno.errors.PermissionDenied);
});
-unitTest({ perms: { read: true } }, function readDirSyncNotDir(): void {
+unitTest({ perms: { read: true } }, function readDirSyncNotDir() {
assertThrows(() => {
Deno.readDirSync("cli/tests/fixture.json");
}, Error);
});
-unitTest({ perms: { read: true } }, function readDirSyncNotFound(): void {
+unitTest({ perms: { read: true } }, function readDirSyncNotFound() {
assertThrows(() => {
Deno.readDirSync("bad_dir_name");
}, Deno.errors.NotFound);
});
-unitTest({ perms: { read: true } }, async function readDirSuccess(): Promise<
- void
-> {
+unitTest({ perms: { read: true } }, async function readDirSuccess() {
const files = [];
for await (const dirEntry of Deno.readDir("cli/tests/")) {
files.push(dirEntry);
@@ -59,9 +57,7 @@ unitTest({ perms: { read: true } }, async function readDirSuccess(): Promise<
assertSameContent(files);
});
-unitTest({ perms: { read: true } }, async function readDirWithUrl(): Promise<
- void
-> {
+unitTest({ perms: { read: true } }, async function readDirWithUrl() {
const files = [];
for await (
const dirEntry of Deno.readDir(pathToAbsoluteFileUrl("cli/tests"))
@@ -71,9 +67,7 @@ unitTest({ perms: { read: true } }, async function readDirWithUrl(): Promise<
assertSameContent(files);
});
-unitTest({ perms: { read: false } }, async function readDirPerm(): Promise<
- void
-> {
+unitTest({ perms: { read: false } }, async function readDirPerm() {
await assertThrowsAsync(async () => {
await Deno.readDir("tests/")[Symbol.asyncIterator]().next();
}, Deno.errors.PermissionDenied);
@@ -92,7 +86,7 @@ unitTest(
unitTest(
{ perms: { read: true }, ignore: Deno.build.os == "windows" },
- function readDirDevFdSync(): void {
+ function readDirDevFdSync() {
for (const _ of Deno.readDirSync("/dev/fd")) {
// We don't actually care whats in here; just that we don't panic on non regular file entries
}