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/os_test.ts | |
parent | 299c7cfe54cb184e0d0c18b00a154c953b433ebf (diff) |
refactor(cli/tests): remove unnecessary void return types (#11577)
Diffstat (limited to 'cli/tests/unit/os_test.ts')
-rw-r--r-- | cli/tests/unit/os_test.ts | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts index daa7a1ca2..d7fb88882 100644 --- a/cli/tests/unit/os_test.ts +++ b/cli/tests/unit/os_test.ts @@ -7,7 +7,7 @@ import { unitTest, } from "./test_util.ts"; -unitTest({ perms: { env: true } }, function envSuccess(): void { +unitTest({ perms: { env: true } }, function envSuccess() { Deno.env.set("TEST_VAR", "A"); const env = Deno.env.toObject(); Deno.env.set("TEST_VAR", "B"); @@ -15,19 +15,19 @@ unitTest({ perms: { env: true } }, function envSuccess(): void { assertNotEquals(Deno.env.get("TEST_VAR"), env["TEST_VAR"]); }); -unitTest({ perms: { env: true } }, function envNotFound(): void { +unitTest({ perms: { env: true } }, function envNotFound() { const r = Deno.env.get("env_var_does_not_exist!"); assertEquals(r, undefined); }); -unitTest({ perms: { env: true } }, function deleteEnv(): void { +unitTest({ perms: { env: true } }, function deleteEnv() { Deno.env.set("TEST_VAR", "A"); assertEquals(Deno.env.get("TEST_VAR"), "A"); assertEquals(Deno.env.delete("TEST_VAR"), undefined); assertEquals(Deno.env.get("TEST_VAR"), undefined); }); -unitTest({ perms: { env: true } }, function avoidEmptyNamedEnv(): void { +unitTest({ perms: { env: true } }, function avoidEmptyNamedEnv() { assertThrows(() => Deno.env.set("", "v"), TypeError); assertThrows(() => Deno.env.set("a=a", "v"), TypeError); assertThrows(() => Deno.env.set("a\0a", "v"), TypeError); @@ -42,13 +42,13 @@ unitTest({ perms: { env: true } }, function avoidEmptyNamedEnv(): void { assertThrows(() => Deno.env.delete("a\0a"), TypeError); }); -unitTest(function envPermissionDenied1(): void { +unitTest(function envPermissionDenied1() { assertThrows(() => { Deno.env.toObject(); }, Deno.errors.PermissionDenied); }); -unitTest(function envPermissionDenied2(): void { +unitTest(function envPermissionDenied2() { assertThrows(() => { Deno.env.get("PATH"); }, Deno.errors.PermissionDenied); @@ -70,7 +70,7 @@ unitTest( const checkChildEnv = async ( inputEnv: Record<string, string>, expectedEnv: Record<string, string>, - ): Promise<void> => { + ) => { const src = ` console.log( ${JSON.stringify(Object.keys(expectedEnv))}.map(k => Deno.env.get(k)) @@ -122,17 +122,17 @@ unitTest( }, ); -unitTest(function osPid(): void { +unitTest(function osPid() { assert(Deno.pid > 0); }); -unitTest(function osPpid(): void { +unitTest(function osPpid() { assert(Deno.ppid > 0); }); unitTest( { perms: { run: true, read: true } }, - async function osPpidIsEqualToPidOfParentProcess(): Promise<void> { + async function osPpidIsEqualToPidOfParentProcess() { const decoder = new TextDecoder(); const process = Deno.run({ cmd: [Deno.execPath(), "eval", "-p", "--unstable", "Deno.ppid"], @@ -148,11 +148,11 @@ unitTest( }, ); -unitTest({ perms: { read: true } }, function execPath(): void { +unitTest({ perms: { read: true } }, function execPath() { assertNotEquals(Deno.execPath(), ""); }); -unitTest({ perms: { read: false } }, function execPathPerm(): void { +unitTest({ perms: { read: false } }, function execPathPerm() { assertThrows( () => { Deno.execPath(); @@ -162,38 +162,38 @@ unitTest({ perms: { read: false } }, function execPathPerm(): void { ); }); -unitTest({ perms: { env: true } }, function loadavgSuccess(): void { +unitTest({ perms: { env: true } }, function loadavgSuccess() { const load = Deno.loadavg(); assertEquals(load.length, 3); }); -unitTest({ perms: { env: false } }, function loadavgPerm(): void { +unitTest({ perms: { env: false } }, function loadavgPerm() { assertThrows(() => { Deno.loadavg(); }, Deno.errors.PermissionDenied); }); -unitTest({ perms: { env: true } }, function hostnameDir(): void { +unitTest({ perms: { env: true } }, function hostnameDir() { assertNotEquals(Deno.hostname(), ""); }); -unitTest({ perms: { env: false } }, function hostnamePerm(): void { +unitTest({ perms: { env: false } }, function hostnamePerm() { assertThrows(() => { Deno.hostname(); }, Deno.errors.PermissionDenied); }); -unitTest({ perms: { env: true } }, function releaseDir(): void { +unitTest({ perms: { env: true } }, function releaseDir() { assertNotEquals(Deno.osRelease(), ""); }); -unitTest({ perms: { env: false } }, function releasePerm(): void { +unitTest({ perms: { env: false } }, function releasePerm() { assertThrows(() => { Deno.osRelease(); }, Deno.errors.PermissionDenied); }); -unitTest({ perms: { env: true } }, function systemMemoryInfo(): void { +unitTest({ perms: { env: true } }, function systemMemoryInfo() { const info = Deno.systemMemoryInfo(); assert(info.total >= 0); assert(info.free >= 0); |