diff options
author | Nate <nfoxley@stedwards.edu> | 2016-12-01 11:32:14 -0600 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2016-12-27 21:56:44 -0800 |
commit | 5f55faa1a02bf77aa87097ffc7b65437897052e3 (patch) | |
tree | f4baa07d490600b1e5b6199c2f9176c4b8f17d78 /test/parallel/test-crypto-random.js | |
parent | 109bfd21d881f9559d08c1cf5f99822a054ed44f (diff) | |
download | android-node-v8-5f55faa1a02bf77aa87097ffc7b65437897052e3.tar.gz android-node-v8-5f55faa1a02bf77aa87097ffc7b65437897052e3.tar.bz2 android-node-v8-5f55faa1a02bf77aa87097ffc7b65437897052e3.zip |
test: add regex to text-crypto-random
PR-URL: https://github.com/nodejs/node/pull/10020
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test/parallel/test-crypto-random.js')
-rw-r--r-- | test/parallel/test-crypto-random.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/test/parallel/test-crypto-random.js b/test/parallel/test-crypto-random.js index a3e9ab2668..28b8847e56 100644 --- a/test/parallel/test-crypto-random.js +++ b/test/parallel/test-crypto-random.js @@ -13,10 +13,11 @@ crypto.DEFAULT_ENCODING = 'buffer'; // bump, we register a lot of exit listeners process.setMaxListeners(256); +const expectedErrorRegexp = /^TypeError: size must be a number >= 0$/; [crypto.randomBytes, crypto.pseudoRandomBytes].forEach(function(f) { [-1, undefined, null, false, true, {}, []].forEach(function(value) { - assert.throws(function() { f(value); }, TypeError); - assert.throws(function() { f(value, function() {}); }, TypeError); + assert.throws(function() { f(value); }, expectedErrorRegexp); + assert.throws(function() { f(value, function() {}); }, expectedErrorRegexp); }); [0, 1, 2, 4, 16, 256, 1024].forEach(function(len) { |