summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/crypto/crypto_cipher_test.ts
diff options
context:
space:
mode:
authorDivy Srivastava <dj.srivastava23@gmail.com>2023-08-26 10:45:37 +0530
committerGitHub <noreply@github.com>2023-08-26 10:45:37 +0530
commit1cb547d885906d557a63b2670c4b1b95a8626826 (patch)
tree64ef1e6f49fbecb44e51e24488f4ac544db10cd1 /cli/tests/unit_node/crypto/crypto_cipher_test.ts
parent37292e74e1a986946ee73edaf81b05bc47b3a201 (diff)
fix(node): propagate create cipher errors (#20280)
Fixes https://github.com/denoland/deno/issues/19002
Diffstat (limited to 'cli/tests/unit_node/crypto/crypto_cipher_test.ts')
-rw-r--r--cli/tests/unit_node/crypto/crypto_cipher_test.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/tests/unit_node/crypto/crypto_cipher_test.ts b/cli/tests/unit_node/crypto/crypto_cipher_test.ts
index 417f5035c..0eecaacf0 100644
--- a/cli/tests/unit_node/crypto/crypto_cipher_test.ts
+++ b/cli/tests/unit_node/crypto/crypto_cipher_test.ts
@@ -199,3 +199,27 @@ Deno.test({
assertEquals(await text(stream), "foo".repeat(15));
},
});
+
+Deno.test({
+ name: "createCipheriv - invalid algorithm",
+ fn() {
+ assertThrows(
+ () =>
+ crypto.createCipheriv("foo", new Uint8Array(16), new Uint8Array(16)),
+ TypeError,
+ "Unknown cipher",
+ );
+ },
+});
+
+Deno.test({
+ name: "createDecipheriv - invalid algorithm",
+ fn() {
+ assertThrows(
+ () =>
+ crypto.createDecipheriv("foo", new Uint8Array(16), new Uint8Array(16)),
+ TypeError,
+ "Unknown cipher",
+ );
+ },
+});