diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2021-08-25 16:04:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 16:04:14 -0400 |
commit | 5d7d9d64434bd0a9f1fcf391dabc51693e8cf1ae (patch) | |
tree | c217fac5a7d67ba326d456b2973d23a7c7b151d4 /cli/tests/unit/net_test.ts | |
parent | 66476efec5b92cd04c161d82cbb69992fed4eb0a (diff) |
chore(tests): improve unit tests using `deferred` (#11842)
Diffstat (limited to 'cli/tests/unit/net_test.ts')
-rw-r--r-- | cli/tests/unit/net_test.ts | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index 65145edc2..bd949b02d 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -394,8 +394,6 @@ unitTest( unitTest( { perms: { net: true } }, async function netTcpListenIteratorBreakClosesResource() { - const promise = deferred(); - async function iterate(listener: Deno.Listener) { let i = 0; @@ -407,13 +405,11 @@ unitTest( break; } } - - promise.resolve(); } const addr = { hostname: "127.0.0.1", port: 8888 }; const listener = Deno.listen(addr); - iterate(listener); + const iteratePromise = iterate(listener); await delay(100); const conn1 = await Deno.connect(addr); @@ -421,7 +417,7 @@ unitTest( const conn2 = await Deno.connect(addr); conn2.close(); - await promise; + await iteratePromise; }, ); |