test: add test case for missing branch

- The case of id is string, flags is number
- The case of flags is not 0

PR-URL: https://github.com/nodejs/node/pull/17418
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
This commit is contained in:
Leko authored and Myles Borins committed 2017-12-12 03:28:07 -05:00
1 parent c9a4f4f8f1
commit 0afcea280e
1 file changed
+17
+17
View File
@@ -5,6 +5,7 @@ if (!common.hasCrypto)
common.skip('missing crypto');
const crypto = require('crypto');
const invalidEngineName = 'xxx';
common.expectsError(
() => crypto.setEngine(true),
@@ -21,3 +22,19 @@ common.expectsError(
type: TypeError,
message: 'The "flags" argument must be of type number'
});
common.expectsError(
() => crypto.setEngine(invalidEngineName),
{
code: 'ERR_CRYPTO_ENGINE_UNKNOWN',
type: Error,
message: `Engine "${invalidEngineName}" was not found`
});
common.expectsError(
() => crypto.setEngine(invalidEngineName, crypto.constants.ENGINE_METHOD_RSA),
{
code: 'ERR_CRYPTO_ENGINE_UNKNOWN',
type: Error,
message: `Engine "${invalidEngineName}" was not found`
});