Skip to content

Commit

Permalink
test: add test case for missing branch
Browse files Browse the repository at this point in the history
- The case of id is string, flags is number
- The case of flags is not 0

PR-URL: #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>
  • Loading branch information
Leko authored and maclover7 committed Dec 3, 2017
1 parent eb19c6b commit 254b5f0
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/parallel/test-crypto-engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ if (!common.hasCrypto)
common.skip('missing crypto');

const crypto = require('crypto');
const invalidEngineName = 'xxx';

common.expectsError(
() => crypto.setEngine(true),
Expand All @@ -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`
});

0 comments on commit 254b5f0

Please sign in to comment.