-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: crypto-hmac test assert.equal -> assert.strictEqual #9958
Conversation
because in 2 cases the assert.equals for several assertions had long arguments, those arguments were misaligned when changing to assert.strictEquals so this commit adds the extra space for alignment. in both cases, the final argument with prepended whitespace extends past the 80 char limit, so these args end up being split onto 2 lines
For me personally, it is ok to have multiple commits. Collaborator responsible for landing can squash if required. 👍 |
assert.strictEqual(wikipedia[i]['hmac'][hash], | ||
result, | ||
'Test HMAC-' + hash + ': Test case ' + (i + 1) | ||
+ ' wikipedia'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may be able to avoid wrapping here by using a template literal:
`Test HMAC-${hash}: Test case ${i + 1} wikipedia`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasnell I updated this using template string
assert.strictEqual(rfc4231[i]['hmac'][hash], | ||
result, | ||
'Test HMAC-' + hash + ': Test case ' + (i + 1) | ||
+ ' rfc 4231'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto here...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jasnell and this one too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple of nits
in 2 cases the change to strictEquals caused extra indentation which made the concatenated assertion failure messages span 2 lines - these were switched to use template strings instead where they now fit onto a single line within the 80 char limit additionally updated the last 2 assertion messages using template strings in order to remain consistent.
@jasnell I also updated the other dynamic assertion messages (2 of them at the bottom) to use template strings for consistency |
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: nodejs#9958 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Landed in 1e4b9a1. |
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: #9958 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: #9958 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
* replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: #9958 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Checklist
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passesAffected core subsystem(s)
Tests for
crypto.createHmac(..)
affectedDescription of change
For better equals assertions within the
test/parallel/test-crypto-hmac.js
switching fromassert.equals(..)
toassert.strictEquals(..)
Question for @maintainers
I had to make a 2nd commit to fix the linting errors.
Should I squash them for the PR?
(the guidelines don't mention this either way)