Skip to content
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

Closed

Conversation

eudaimos
Copy link
Contributor

@eudaimos eudaimos commented Dec 1, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • commit message follows commit guidelines
Affected core subsystem(s)

Tests for crypto.createHmac(..) affected

Description of change

For better equals assertions within the test/parallel/test-crypto-hmac.js switching from assert.equals(..) to assert.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)

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
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Dec 1, 2016
@imyller imyller added the code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. label Dec 1, 2016
@mscdex mscdex added the crypto Issues and PRs related to the crypto subsystem. label Dec 1, 2016
@imyller
Copy link
Member

imyller commented Dec 1, 2016

Should I squash them for the PR?

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');
Copy link
Member

@jasnell jasnell Dec 5, 2016

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`

Copy link
Contributor Author

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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto here...

Copy link
Contributor Author

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

Copy link
Member

@jasnell jasnell left a 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.
@Trott
Copy link
Member

Trott commented Dec 7, 2016

@eudaimos
Copy link
Contributor Author

eudaimos commented Dec 8, 2016

@jasnell I also updated the other dynamic assertion messages (2 of them at the bottom) to use template strings for consistency

Trott pushed a commit to Trott/io.js that referenced this pull request Dec 8, 2016
* 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>
@Trott
Copy link
Member

Trott commented Dec 8, 2016

Landed in 1e4b9a1.
Thanks for the contribution! 🎉

@Trott Trott closed this Dec 8, 2016
@eudaimos
Copy link
Contributor Author

eudaimos commented Dec 9, 2016

Awesome! My first one - thanks @Trott and @jasnell

Fishrock123 pushed a commit that referenced this pull request Dec 13, 2016
* 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>
@italoacasas italoacasas mentioned this pull request Dec 15, 2016
MylesBorins pushed a commit that referenced this pull request Dec 20, 2016
* 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>
MylesBorins pushed a commit that referenced this pull request Dec 21, 2016
* 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>
@MylesBorins MylesBorins mentioned this pull request Dec 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-and-learn Issues related to the Code-and-Learn events and PRs submitted during the events. crypto Issues and PRs related to the crypto subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants