Browse Source

test: use regex error check in test-crypto-random

Replace constructor in assert.throws() to a regular expression to check
the error thrown in a test in test-crypto-random.

PR-URL: https://github.com/nodejs/node/pull/14273
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Zhang Weijie 8 years ago
committed by Rich Trott
parent
commit
c3cb0edd8d
  1. 2
      test/parallel/test-crypto-random.js

2
test/parallel/test-crypto-random.js

@ -264,4 +264,4 @@ const expectedErrorRegexp = /^TypeError: size must be a number >= 0$/;
// length exceeds max acceptable value"
assert.throws(function() {
crypto.randomBytes((-1 >>> 0) + 1);
}, TypeError);
}, /^TypeError: size must be a number >= 0$/);

Loading…
Cancel
Save