diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index fdb63afa7659f3..0441da159d9447 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -64,6 +64,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);