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/fetch_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/fetch_test.ts')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index c1f11093b..05c04f4ef 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -3,7 +3,6 @@ import { assert, assertEquals, assertRejects, - deferred, delay, fail, unimplemented, @@ -1260,13 +1259,13 @@ Deno.test( Deno.test( { permissions: { net: true } }, async function fetchNoServerReadableStreamBody() { - const done = deferred(); + const { promise, resolve } = Promise.withResolvers<void>(); const body = new ReadableStream({ start(controller) { controller.enqueue(new Uint8Array([1])); setTimeout(() => { controller.enqueue(new Uint8Array([2])); - done.resolve(); + resolve(); }, 1000); }, }); @@ -1274,7 +1273,7 @@ Deno.test( await assertRejects(async () => { await fetch(nonExistentHostname, { body, method: "POST" }); }, TypeError); - await done; + await promise; }, ); |