Skip to content

Commit cd1a7ea

Browse files
NFoxleyMylesBorins
authored andcommitted
test: add regex to text-crypto-random
PR-URL: #10020 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 15226f5 commit cd1a7ea

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ crypto.DEFAULT_ENCODING = 'buffer'
1313
// bump, we register a lot of exit listeners
1414
process.setMaxListeners(256);
1515

16+
constexpectedErrorRegexp=/^TypeError:sizemustbeanumber>=0$/;
1617
[crypto.randomBytes,crypto.pseudoRandomBytes].forEach(function(f){
1718
[-1,undefined,null,false,true,{},[]].forEach(function(value){
18-
assert.throws(function(){f(value);},TypeError);
19-
assert.throws(function(){f(value,function(){});},TypeError);
19+
assert.throws(function(){f(value);},expectedErrorRegexp);
20+
assert.throws(function(){f(value,function(){});},expectedErrorRegexp);
2021
});
2122

2223
[0,1,2,4,16,256,1024].forEach(function(len){

0 commit comments

Comments
(0)