diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2021-06-25 10:44:14 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-25 03:44:14 +0200 |
commit | 66c5f41c5bd5fa08daa09f8650135000c1787829 (patch) | |
tree | 05ad5900822d01316ad0c193cd7fcc7953bdf32c /cli/tests/unit/net_test.ts | |
parent | dd4ed825762d32ca9f791bda3bb9c459886c7061 (diff) |
test(cli): refactor the usages of delay (#11098)
This PR refactors the usages of delay utility in js unit testing. The same
utiliy is defined in several places with different names. This PR replaces those
usages with the one provided in std/async/delay.ts to improve the readability
and consistency of test code.
Diffstat (limited to 'cli/tests/unit/net_test.ts')
-rw-r--r-- | cli/tests/unit/net_test.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index 725bb9684..802800e28 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -6,6 +6,7 @@ import { assertThrows, assertThrowsAsync, deferred, + delay, unitTest, } from "./test_util.ts"; @@ -409,9 +410,7 @@ unitTest( const listener = Deno.listen(addr); iterate(listener); - await new Promise<void>((resolve) => { - setTimeout(resolve, 100); - }); + await delay(100); const conn1 = await Deno.connect(addr); conn1.close(); const conn2 = await Deno.connect(addr); |