Skip to content

Commit

Permalink
test: improve code coverage in webcrypto API
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
juanarbol authored and jasnell committed Apr 6, 2021
1 parent 005ebaf commit 30d7f05
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/parallel/test-webcrypto-sign-verify-hmac.js
Original file line number Diff line number Diff line change
Expand Up @@ -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), {
Expand Down

0 comments on commit 30d7f05

Please sign in to comment.