diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2023-11-22 22:11:20 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-22 12:11:20 +0100 |
commit | 616354e76cba0be8af20a0ffefeacfcf6101bafc (patch) | |
tree | c832c81dd93498e196840c8d59c0a4ab76396d07 /cli/tests/unit_node/internal/scrypt_test.ts | |
parent | 0ffcb46e0f60110c07e21151db6066f5a1b5f710 (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/internal/scrypt_test.ts')
-rw-r--r-- | cli/tests/unit_node/internal/scrypt_test.ts | 9 |
1 files changed, 4 insertions, 5 deletions
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<boolean>(); 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<boolean>(); scrypt( "password", @@ -101,7 +100,7 @@ Deno.test("scrypt works with options", async () => { 71, ]), ); - promise.resolve(true); + resolve(true); }, ); |