diff options
author | Tareque Md Hanif <tarequemd.hanif@yahoo.com> | 2023-11-11 03:29:09 +0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 14:29:09 -0700 |
commit | eff3e432966f6bc9ed909ba22fcafc0978c924d7 (patch) | |
tree | 9081548c2f804f312121673c4070825831605495 /cli/tests/unit/broadcast_channel_test.ts | |
parent | df14835b83085017e9cf9ae66a71cd523385c5c4 (diff) |
chore(cli): Migrate some unit tests to "Promise.withResolvers()" (#21128)
Migrate to use `Promise.withResolvers()` instead of `deferred` in some
of the tests in `cli/tests/unit/`.
Issue: #21041
Diffstat (limited to 'cli/tests/unit/broadcast_channel_test.ts')
-rw-r--r-- | cli/tests/unit/broadcast_channel_test.ts | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/cli/tests/unit/broadcast_channel_test.ts b/cli/tests/unit/broadcast_channel_test.ts index b13a47574..fecb26b16 100644 --- a/cli/tests/unit/broadcast_channel_test.ts +++ b/cli/tests/unit/broadcast_channel_test.ts @@ -1,6 +1,5 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. import { assertEquals } from "../../../test_util/std/testing/asserts.ts"; -import { deferred } from "../../../test_util/std/async/deferred.ts"; Deno.test("BroadcastChannel worker", async () => { const intercom = new BroadcastChannel("intercom"); @@ -12,7 +11,7 @@ Deno.test("BroadcastChannel worker", async () => { const worker = new Worker(url, { type: "module", name: "worker" }); worker.onmessage = () => intercom.postMessage(++count); - const promise = deferred(); + const { promise, resolve } = Promise.withResolvers<void>(); intercom.onmessage = function (e) { assertEquals(count, e.data); @@ -21,7 +20,7 @@ Deno.test("BroadcastChannel worker", async () => { } else { worker.terminate(); intercom.close(); - promise.resolve(); + resolve(); } }; |