diff options
author | Leo K <crowlkats@toaxl.com> | 2021-08-05 13:08:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-05 13:08:58 +0200 |
commit | 3f0cf9619fce71a8898c495501df4bdb0e07e735 (patch) | |
tree | 1b8af2c832f8344f9a39f55326d576eab63f447f /cli/tests/unit/read_dir_test.ts | |
parent | 299c7cfe54cb184e0d0c18b00a154c953b433ebf (diff) |
refactor(cli/tests): remove unnecessary void return types (#11577)
Diffstat (limited to 'cli/tests/unit/read_dir_test.ts')
-rw-r--r-- | cli/tests/unit/read_dir_test.ts | 26 |
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 } |