test: improve crypto coverage
* call Certificate function directly * check exception when sign option is undefined PR-URL: https://github.com/nodejs/node/pull/11280 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
e4e7cd5bd2
commit
036eef1003
@ -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);
|
||||
|
@ -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$/);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user