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 <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
  • Loading branch information
Leko authored and MylesBorins committed Dec 12, 2017
1 parent c9a4f4f commit 0afcea2
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 0afcea2

Please sign in to comment.