Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0ccb2c3

Browse filesBrowse files
targosaddaleax
authored andcommitted
test: refactor test-crypto-timing-safe-equal
Add RegExp arguments to throws assertions. PR-URL: #9843 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Teddy Katz <teddy.katz@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 0bdd5ca commit 0ccb2c3
Copy full SHA for 0ccb2c3

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Open diff view settings
Collapse file

‎test/sequential/test-crypto-timing-safe-equal.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-crypto-timing-safe-equal.js
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ assert.strictEqual(
2323

2424
assert.throws(function() {
2525
crypto.timingSafeEqual(Buffer.from([1, 2, 3]), Buffer.from([1, 2]));
26-
}, 'should throw when given buffers with different lengths');
26+
}, /^TypeError: Input buffers must have the same length$/,
27+
'should throw when given buffers with different lengths');
2728

2829
assert.throws(function() {
2930
crypto.timingSafeEqual('not a buffer', Buffer.from([1, 2]));
30-
}, 'should throw if the first argument is not a buffer');
31+
}, /^TypeError: First argument must be a buffer$/,
32+
'should throw if the first argument is not a buffer');
3133

3234
assert.throws(function() {
3335
crypto.timingSafeEqual(Buffer.from([1, 2]), 'not a buffer');
34-
}, 'should throw if the second argument is not a buffer');
36+
}, /^TypeError: Second argument must be a buffer$/,
37+
'should throw if the second argument is not a buffer');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.