summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/async_hooks_test.ts
diff options
context:
space:
mode:
authorAsher Gomez <ashersaupingomez@gmail.com>2023-11-22 22:11:20 +1100
committerGitHub <noreply@github.com>2023-11-22 12:11:20 +0100
commit616354e76cba0be8af20a0ffefeacfcf6101bafc (patch)
treec832c81dd93498e196840c8d59c0a4ab76396d07 /cli/tests/unit_node/async_hooks_test.ts
parent0ffcb46e0f60110c07e21151db6066f5a1b5f710 (diff)
refactor: replace `deferred()` from `std/async` with `Promise.withResolvers()` (#21234)
Closes #21041 --------- Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Diffstat (limited to 'cli/tests/unit_node/async_hooks_test.ts')
-rw-r--r--cli/tests/unit_node/async_hooks_test.ts13
1 files changed, 6 insertions, 7 deletions
diff --git a/cli/tests/unit_node/async_hooks_test.ts b/cli/tests/unit_node/async_hooks_test.ts
index 871ad85f9..035e970d4 100644
--- a/cli/tests/unit_node/async_hooks_test.ts
+++ b/cli/tests/unit_node/async_hooks_test.ts
@@ -4,7 +4,6 @@ import {
assert,
assertEquals,
} from "../../../test_util/std/testing/asserts.ts";
-import { deferred } from "../../../test_util/std/async/deferred.ts";
Deno.test(async function foo() {
const asyncLocalStorage = new AsyncLocalStorage();
@@ -68,16 +67,16 @@ Deno.test(async function bar() {
Deno.test(async function nested() {
const als = new AsyncLocalStorage();
- const promise = deferred();
- const promise1 = deferred();
+ const deferred = Promise.withResolvers();
+ const deferred1 = Promise.withResolvers();
als.run(null, () => {
als.run({ x: 1 }, () => {
- promise.resolve(als.getStore());
+ deferred.resolve(als.getStore());
});
- promise1.resolve(als.getStore());
+ deferred1.resolve(als.getStore());
});
- assertEquals(await promise, { x: 1 });
- assertEquals(await promise1, null);
+ assertEquals(await deferred.promise, { x: 1 });
+ assertEquals(await deferred1.promise, null);
});