diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2019-04-21 16:40:10 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-21 16:40:10 -0400 |
commit | 9dfebbc9496138efbeedc431068f41662c780f3e (patch) | |
tree | c3718c3dc132d11c08c8fc18933daebf886bf787 /js/resources_test.ts | |
parent | 6cded14bdf313762956d4d5361cfe8115628b535 (diff) |
Fix eslint warnings (#2151)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Co-authored-by: LE GOFF Vincent <g_n_s@hotmail.fr>
Diffstat (limited to 'js/resources_test.ts')
-rw-r--r-- | js/resources_test.ts | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/js/resources_test.ts b/js/resources_test.ts index eeb3b3449..9d68f49f6 100644 --- a/js/resources_test.ts +++ b/js/resources_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. import { test, testPerm, assertEquals } from "./test_util.ts"; -test(function resourcesStdio() { +test(function resourcesStdio(): void { const res = Deno.resources(); assertEquals(res[0], "stdin"); @@ -9,7 +9,7 @@ test(function resourcesStdio() { assertEquals(res[2], "stderr"); }); -testPerm({ net: true }, async function resourcesNet() { +testPerm({ net: true }, async function resourcesNet(): Promise<void> { const addr = "127.0.0.1:4501"; const listener = Deno.listen("tcp", addr); @@ -17,15 +17,21 @@ testPerm({ net: true }, async function resourcesNet() { const listenerConn = await listener.accept(); const res = Deno.resources(); - assertEquals(Object.values(res).filter(r => r === "tcpListener").length, 1); - assertEquals(Object.values(res).filter(r => r === "tcpStream").length, 2); + assertEquals( + Object.values(res).filter((r): boolean => r === "tcpListener").length, + 1 + ); + assertEquals( + Object.values(res).filter((r): boolean => r === "tcpStream").length, + 2 + ); listenerConn.close(); dialerConn.close(); listener.close(); }); -testPerm({ read: true }, async function resourcesFile() { +testPerm({ read: true }, async function resourcesFile(): Promise<void> { const resourcesBefore = Deno.resources(); await Deno.open("tests/hello.txt"); const resourcesAfter = Deno.resources(); @@ -35,8 +41,10 @@ testPerm({ read: true }, async function resourcesFile() { Object.keys(resourcesAfter).length, Object.keys(resourcesBefore).length + 1 ); - const newRid = Object.keys(resourcesAfter).find(rid => { - return !resourcesBefore.hasOwnProperty(rid); - }); + const newRid = Object.keys(resourcesAfter).find( + (rid): boolean => { + return !resourcesBefore.hasOwnProperty(rid); + } + ); assertEquals(resourcesAfter[newRid], "fsFile"); }); |