Skip to content

test: improve the code in test-crypto-rsa-dsa - #10681

Closed
edsadr wants to merge 1 commit into
nodejs:masterfrom
edsadr:crypto-rsa
Closed

test: improve the code in test-crypto-rsa-dsa#10681
edsadr wants to merge 1 commit into
nodejs:masterfrom
edsadr:crypto-rsa

Conversation

@edsadr

Copy link
Copy Markdown
Contributor
  • use const and let instead of var
  • use assert.strictEqual instead of assert.equal
  • use arrow functions
  • swap assertions arguments to match the standard
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

@nodejs-github-botnodejs-github-bot added test Issues and PRs related to the tests. dont-land-on-v7.x labels Jan 8, 2017
@mscdexmscdex added crypto Issues and PRs related to the crypto subsystem. and removed dont-land-on-v7.x labels Jan 8, 2017
@Trott

Trott commented Jan 8, 2017

Copy link
Copy Markdown
Member

There are five instances of assert.throws() that get just one argument (the function containing code to run). While you're in there improving the test, it would be great if you could add a second argument containing a RegExp that matches the resulting error message.

Comment threadtest/parallel/test-crypto-rsa-dsa.js Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you name this expectedSignature?

@edsadr

Copy link
Copy Markdown
ContributorAuthor

@Trott , @cjihrig , did as suggested

Comment threadtest/parallel/test-crypto-rsa-dsa.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: isn't it better to compare the two buffers directly instead of their string representation?

assert.deepStrictEqual(decryptedBuffer,input);

or

assert(decryptedBuffer.equals(input));

Comment threadtest/parallel/test-crypto-rsa-dsa.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: I think should be shifted to the left by 2 spaces.

* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
@edsadr

Copy link
Copy Markdown
ContributorAuthor

@lpinca , did as suggested

@lpinca

Copy link
Copy Markdown
Member

@lpinca

Copy link
Copy Markdown
Member

Landed in 85a9034.

@lpincalpinca closed this Jan 10, 2017
lpinca pushed a commit that referenced this pull request Jan 10, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: #10681
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: nodejs#10681
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 23, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: nodejs#10681
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
targos pushed a commit that referenced this pull request Jan 28, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: #10681
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@italoacasasitaloacasas mentioned this pull request Jan 29, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: nodejs#10681
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 30, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: nodejs#10681
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@jasnell

Copy link
Copy Markdown
Member

This will need backport PRs in order to land on v6 or v4

gibfahn pushed a commit that referenced this pull request Jun 19, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: #10681
Backport-PR-URL: #13785
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
gibfahn pushed a commit that referenced this pull request Jun 20, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: #10681
Backport-PR-URL: #13785
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
MylesBorins pushed a commit that referenced this pull request Jul 11, 2017
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: #10681
Backport-PR-URL: #13785
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Jul 18, 2017
abhishekumar-tyagi pushed a commit to abhishekumar-tyagi/node that referenced this pull request May 5, 2024
* use const and let instead of var
* use assert.strictEqual or assert.strictDeepEqual instead of assert.equal
* use arrow functions
* swap assertions arguments to match the standard
* validate the error for assert.throws
PR-URL: nodejs/node#10681
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cryptoIssues and PRs related to the crypto subsystem.testIssues and PRs related to the tests.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants

@edsadr@Trott@lpinca@jasnell@cjihrig@mscdex@gibfahn@nodejs-github-bot