diff --git a/test/parallel/test-crypto-engine.js b/test/parallel/test-crypto-engine.js index b731ec2f0372fa..43f8b8084c7fe9 100644 --- a/test/parallel/test-crypto-engine.js +++ b/test/parallel/test-crypto-engine.js @@ -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` + });