mirror of https://github.com/nodejs/node.git
test: refactor test-crypto-timing-safe-equal
Add RegExp arguments to throws assertions. PR-URL: https://github.com/nodejs/node/pull/9843 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
8264a22256
commit
cf719152b0
|
@ -23,12 +23,15 @@ assert.strictEqual(
|
|||
|
||||
assert.throws(function() {
|
||||
crypto.timingSafeEqual(Buffer.from([1, 2, 3]), Buffer.from([1, 2]));
|
||||
}, 'should throw when given buffers with different lengths');
|
||||
}, /^TypeError: Input buffers must have the same length$/,
|
||||
'should throw when given buffers with different lengths');
|
||||
|
||||
assert.throws(function() {
|
||||
crypto.timingSafeEqual('not a buffer', Buffer.from([1, 2]));
|
||||
}, 'should throw if the first argument is not a buffer');
|
||||
}, /^TypeError: First argument must be a buffer$/,
|
||||
'should throw if the first argument is not a buffer');
|
||||
|
||||
assert.throws(function() {
|
||||
crypto.timingSafeEqual(Buffer.from([1, 2]), 'not a buffer');
|
||||
}, 'should throw if the second argument is not a buffer');
|
||||
}, /^TypeError: Second argument must be a buffer$/,
|
||||
'should throw if the second argument is not a buffer');
|
||||
|
|
Loading…
Reference in New Issue