From 616354e76cba0be8af20a0ffefeacfcf6101bafc Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Wed, 22 Nov 2023 22:11:20 +1100 Subject: refactor: replace `deferred()` from `std/async` with `Promise.withResolvers()` (#21234) Closes #21041 --------- Signed-off-by: Asher Gomez --- cli/tests/unit_node/internal/scrypt_test.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'cli/tests/unit_node/internal/scrypt_test.ts') diff --git a/cli/tests/unit_node/internal/scrypt_test.ts b/cli/tests/unit_node/internal/scrypt_test.ts index d65cd27ff..83830f8e4 100644 --- a/cli/tests/unit_node/internal/scrypt_test.ts +++ b/cli/tests/unit_node/internal/scrypt_test.ts @@ -2,10 +2,9 @@ import { scrypt, scryptSync } from "node:crypto"; import { Buffer } from "node:buffer"; import { assertEquals } from "../../../../test_util/std/testing/asserts.ts"; -import { deferred } from "../../../../test_util/std/async/deferred.ts"; Deno.test("scrypt works correctly", async () => { - const promise = deferred(); + const { promise, resolve } = Promise.withResolvers(); scrypt("password", "salt", 32, (err, key) => { if (err) throw err; @@ -46,14 +45,14 @@ Deno.test("scrypt works correctly", async () => { 115, ]), ); - promise.resolve(true); + resolve(true); }); await promise; }); Deno.test("scrypt works with options", async () => { - const promise = deferred(); + const { promise, resolve } = Promise.withResolvers(); scrypt( "password", @@ -101,7 +100,7 @@ Deno.test("scrypt works with options", async () => { 71, ]), ); - promise.resolve(true); + resolve(true); }, ); -- cgit v1.2.3