diff options
Diffstat (limited to 'cli/tests/unit_node/util_test.ts')
-rw-r--r-- | cli/tests/unit_node/util_test.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/cli/tests/unit_node/util_test.ts b/cli/tests/unit_node/util_test.ts index 2e2bb0021..a88128ee9 100644 --- a/cli/tests/unit_node/util_test.ts +++ b/cli/tests/unit_node/util_test.ts @@ -292,3 +292,26 @@ Deno.test({ fn(); }, }); + +Deno.test({ + name: "[util] callbackify() works", + fn() { + const fn = util.callbackify(() => Promise.resolve("foo")); + fn((err, value) => { + assert(err === null); + assert(value === "foo"); + }); + }, +}); + +Deno.test({ + name: "[util] callbackify(undefined) throws", + fn() { + assertThrows( + // @ts-expect-error: testing runtime error + () => util.callbackify(undefined), + TypeError, + 'The "original" argument must be of type function', + ); + }, +}); |