From 30d7f05fef08a15f33fa77849966b604a4019e54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Jos=C3=A9=20Arboleda?= Date: Fri, 2 Apr 2021 20:04:18 -0500 Subject: [PATCH] test: improve code coverage in webcrypto API PR-URL: https://github.com/nodejs/node/pull/38052 Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Benjamin Gruenbaum Reviewed-By: James M Snell --- test/parallel/test-webcrypto-sign-verify-hmac.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/parallel/test-webcrypto-sign-verify-hmac.js b/test/parallel/test-webcrypto-sign-verify-hmac.js index b0eccad85f0160..3028816054ca76 100644 --- a/test/parallel/test-webcrypto-sign-verify-hmac.js +++ b/test/parallel/test-webcrypto-sign-verify-hmac.js @@ -152,6 +152,13 @@ async function testSign({ hash, assert(await subtle.verify({ name, hash }, key, sig, plaintext)); } + await assert.rejects( + subtle.generateKey({ name }, false, []), { + name: 'TypeError', + code: 'ERR_MISSING_OPTION', + message: 'algorithm.hash is required' + }); + // Test failure when no sign usage await assert.rejects( subtle.sign({ name, hash }, noSignKey, plaintext), {