diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index ebd83b019ba146..c051716556410d 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -37,3 +37,6 @@ assert.strictEqual(certificate.exportChallenge(spkacFail), ''); function stripLineEndings(obj) { return obj.replace(/\n/g, ''); } + +// direct call Certificate() should return instance +assert(crypto.Certificate() instanceof crypto.Certificate); diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index ae78cd9d8b3420..81b2c109b69b20 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -70,3 +70,10 @@ const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii'); verified = verStream.verify(certPem, s3); assert.strictEqual(verified, true, 'sign and verify (stream)'); } + +// Test throws exception when key options is null +{ + assert.throws(() => { + crypto.createSign('RSA-SHA1').update('Test123').sign(null, 'base64'); + }, /^Error: No key provided to sign$/); +}