Skip to content

Commit

Permalink
test: crypto KeyObject.from() ERR_INVALID_ARG_TYPE
Browse files Browse the repository at this point in the history
PR-URL: #37890
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
  • Loading branch information
peZhmanParsaee authored and jasnell committed Apr 30, 2021
1 parent c7ccab3 commit 3c6ff9e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/parallel/test-crypto-key-objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,16 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem',
});
}

{
assert.throws(() => KeyObject.from('invalid_key'), {
name: 'TypeError',
code: 'ERR_INVALID_ARG_TYPE',
message:
'The "key" argument must be an instance of CryptoKey. Received type ' +
"string ('invalid_key')"
});
}

{
const keybuf = randomBytes(32);
const key = createSecretKey(keybuf);
Expand Down

0 comments on commit 3c6ff9e

Please sign in to comment.