diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index d7b3f9af83acd9..aa57aaa41f4813 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -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);