test: improve code coverage in webcrypto API

PR-URL: https://github.com/nodejs/node/pull/38052
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Juan José Arboleda 2021-04-02 20:04:18 -05:00 committed by James M Snell
parent 005ebafbd1
commit 30d7f05fef
No known key found for this signature in database
GPG Key ID: 7341B15C070877AC

View File

@ -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), {