aboutsummaryrefslogtreecommitdiff
path: root/test/parallel/test-crypto-engine.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-09-06 08:10:34 -0700
committerJames M Snell <jasnell@gmail.com>2017-09-18 08:10:59 -0700
commitc75f87cc4c8d3699e081d37bb5bf47a70d830fdb (patch)
tree9d79319f568ff43e36e05a8d2634130adfacfb74 /test/parallel/test-crypto-engine.js
parent8fa5fcc0ba74c23490c34da1a6c6e9a454280740 (diff)
downloadandroid-node-v8-c75f87cc4c8d3699e081d37bb5bf47a70d830fdb.tar.gz
android-node-v8-c75f87cc4c8d3699e081d37bb5bf47a70d830fdb.tar.bz2
android-node-v8-c75f87cc4c8d3699e081d37bb5bf47a70d830fdb.zip
crypto: refactor the crypto module
* Split single monolithic file into multiple * Make Certificate methods static * Allow randomFill(Sync) to use any ArrayBufferView * Use internal/errors throughout * Improve arg validation in Hash/Hmac * Doc updates PR-URL: https://github.com/nodejs/node/pull/15231 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'test/parallel/test-crypto-engine.js')
-rw-r--r--test/parallel/test-crypto-engine.js21
1 files changed, 14 insertions, 7 deletions
diff --git a/test/parallel/test-crypto-engine.js b/test/parallel/test-crypto-engine.js
index b2fe154d3c..b731ec2f03 100644
--- a/test/parallel/test-crypto-engine.js
+++ b/test/parallel/test-crypto-engine.js
@@ -4,13 +4,20 @@ const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
-const assert = require('assert');
const crypto = require('crypto');
-assert.throws(function() {
- crypto.setEngine(true);
-}, /^TypeError: "id" argument should be a string$/);
+common.expectsError(
+ () => crypto.setEngine(true),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError,
+ message: 'The "id" argument must be of type string'
+ });
-assert.throws(function() {
- crypto.setEngine('/path/to/engine', 'notANumber');
-}, /^TypeError: "flags" argument should be a number, if present$/);
+common.expectsError(
+ () => crypto.setEngine('/path/to/engine', 'notANumber'),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError,
+ message: 'The "flags" argument must be of type number'
+ });