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: refactor of zlib-from-gzip-with-trailing-garbage #10674

Closed
wants to merge 2 commits into from
Closed

test: refactor of zlib-from-gzip-with-trailing-garbage #10674

wants to merge 2 commits into from

Conversation

lfkwtz
Copy link
Contributor

@lfkwtz lfkwtz commented Jan 7, 2017

  • use assert.strictEqual instead of assert.equal
  • add RegExp in second argument of assert.throws
  • removed unused arguments
Checklist
  • [ x ] commit message follows commit guidelines

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Jan 7, 2017
@mscdex mscdex added the zlib Issues and PRs related to the zlib subsystem. label Jan 7, 2017

zlib.gunzip(data, common.mustCall((err, result) => {
zlib.gunzip(data, common.mustCall((err) => {
assert(err);
Copy link
Member

Choose a reason for hiding this comment

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

it would likely be worthwhile validating the details of the error reported

Copy link
Member

Choose a reason for hiding this comment

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

I would also recommend restoring result as an argument and adding an assertion for it. So all together, maybe something like this?:

assert(err instanceof Error);
assert.strictEqual(err.code, 'Z_DATA_ERROR');
assert.strictEqual(err.message, 'unknown compression method');
assert.strictEqual(result, undefined);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

New commit pushed up with these suggestions included. Thanks to the both of you for the help. Long time listener, first time committer. 😄

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 one suggestion


zlib.gunzip(data, common.mustCall((err, result) => {
zlib.gunzip(data, common.mustCall((err) => {
Copy link
Member

Choose a reason for hiding this comment

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

Same suggestions here as above. Restore result, add an assertion to confirm it is undefined, and do some more rigorous checking on err.

* use assert.strictEqual instead of assert.equal
* add RegExp in second argument of assert.throws
* removed unused arguments
* restore result args and validate response
* validate error message and code
@jasnell
Copy link
Member

jasnell commented Jan 9, 2017

@lfkwtz
Copy link
Contributor Author

lfkwtz commented Jan 9, 2017

@jasnell I see one test failed... any suggestion on how to fix this?

@lpinca
Copy link
Member

lpinca commented Jan 9, 2017

@leftynaut test/arm is marked as failed but it actually passed, you can see this if you click on details. CI is 100% green 🎉 .

@jbergstroem
Copy link
Member

@lpinca said:
@leftynaut test/arm is marked as failed but it actually passed, you can see this if you click on details. CI is 100% green 🎉 .

Bug here: nodejs/github-bot#108

Trott pushed a commit to Trott/io.js that referenced this pull request Jan 10, 2017
* use assert.strictEqual instead of assert.equal
* add RegExp in second argument of assert.throws
* validate error message and code

PR-URL: nodejs#10674
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@Trott
Copy link
Member

Trott commented Jan 10, 2017

Landed in 39c4af5.
Thanks for the contribution! 🎉

@Trott Trott closed this Jan 10, 2017
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 18, 2017
* use assert.strictEqual instead of assert.equal
* add RegExp in second argument of assert.throws
* validate error message and code

PR-URL: nodejs#10674
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 23, 2017
* use assert.strictEqual instead of assert.equal
* add RegExp in second argument of assert.throws
* validate error message and code

PR-URL: nodejs#10674
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 25, 2017
* use assert.strictEqual instead of assert.equal
* add RegExp in second argument of assert.throws
* validate error message and code

PR-URL: nodejs#10674
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
italoacasas pushed a commit to italoacasas/node that referenced this pull request Jan 27, 2017
* use assert.strictEqual instead of assert.equal
* add RegExp in second argument of assert.throws
* validate error message and code

PR-URL: nodejs#10674
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@italoacasas italoacasas mentioned this pull request Jan 29, 2017
MylesBorins pushed a commit that referenced this pull request Mar 8, 2017
* use assert.strictEqual instead of assert.equal
* add RegExp in second argument of assert.throws
* validate error message and code

PR-URL: #10674
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
MylesBorins pushed a commit that referenced this pull request Mar 9, 2017
* use assert.strictEqual instead of assert.equal
* add RegExp in second argument of assert.throws
* validate error message and code

PR-URL: #10674
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Mar 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Issues and PRs related to the tests. zlib Issues and PRs related to the zlib subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants