diff --git a/test/parallel/test-crypto-dh.js b/test/parallel/test-crypto-dh.js index 6a067bef1be066..884b482fc53450 100644 --- a/test/parallel/test-crypto-dh.js +++ b/test/parallel/test-crypto-dh.js @@ -170,6 +170,10 @@ let firstByte = ecdh1.getPublicKey('buffer', 'compressed')[0]; assert(firstByte === 2 || firstByte === 3); firstByte = ecdh1.getPublicKey('buffer', 'hybrid')[0]; assert(firstByte === 6 || firstByte === 7); +// format value should be string +assert.throws(() => { + ecdh1.getPublicKey('buffer', 10); +}, /^TypeError: Bad format: 10$/); // ECDH should check that point is on curve const ecdh3 = crypto.createECDH('secp256k1'); @@ -262,3 +266,8 @@ ecdh5.setPrivateKey(cafebabeKey, 'hex'); // Verify object state did not change. assert.equal(ecdh5.getPrivateKey('hex'), cafebabeKey); }); + +// invalid test: curve argument is undefined +assert.throws(() => { + crypto.createECDH(); +}, /^TypeError: "curve" argument should be a string$/);