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: cleanup test-c-ares.js #8577

Closed
wants to merge 1 commit into from

Conversation

sejoker
Copy link
Contributor

@sejoker sejoker commented Sep 17, 2016

Cleanup according to nodejs/code-and-learn#56

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

test

Description of change
  • replace equal with strictEqual
  • use const instead of var
  • wrap callbacks into common.mustCall()

@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Sep 17, 2016
@MichaelTSS
Copy link

Hey @sejoker I read your file changes and was wondering why did you wrapped callbacks into common.mustCall()?
What does it change?

@sejoker
Copy link
Contributor Author

sejoker commented Sep 17, 2016

@MichaelTSS according to best practices from writing_tests.md we use common.mustCall() to ensure that some callbacks/listeners are called

@mscdex mscdex added the cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. label Sep 17, 2016
@cjihrig
Copy link
Contributor

cjihrig commented Sep 17, 2016

LGTM with a comment.

@@ -36,8 +36,8 @@ assert.throws(function() {
// C:\Windows\System32\drivers\etc\hosts
// so we disable this test on Windows.
if (!common.isWindows) {
dns.reverse('127.0.0.1', function(error, domains) {
dns.reverse('127.0.0.1', common.mustCall(function(error, domains) {
if (error) throw error;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you change this line to assert.ifError(error);.

Copy link
Contributor Author

@sejoker sejoker Sep 18, 2016

Choose a reason for hiding this comment

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

@cjihrig updated PR according to feedback.

replace equal with strictEqual, use const instead of var
replace throw error with assert.ifError
@sejoker sejoker force-pushed the tests-cleanup-strict-equal branch from 1258850 to 012e80a Compare September 18, 2016 08:33
Copy link
Contributor

@cjihrig cjihrig left a comment

Choose a reason for hiding this comment

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

LGTM

@cjihrig
Copy link
Contributor

cjihrig commented Sep 18, 2016

Copy link
Member

@lpinca lpinca left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@imyller imyller left a comment

Choose a reason for hiding this comment

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

LGTM

@imyller imyller changed the title test:parallel: cleanup test-c-ares.js test: cleanup test-c-ares.js Sep 19, 2016
@imyller
Copy link
Member

imyller commented Sep 19, 2016

I'll start the process of landing this.

Will amend the commit title to: test: cleanup test-c-ares.js

@imyller imyller self-assigned this Sep 19, 2016
imyller pushed a commit that referenced this pull request Sep 19, 2016
Replace equal with strictEqual, use const instead of var
Replace throw error with assert.ifError

PR-URL: #8577
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
@imyller
Copy link
Member

imyller commented Sep 19, 2016

landed in 9fb59df

Thank you, @sejoker

@imyller imyller closed this Sep 19, 2016
@imyller imyller removed their assignment Sep 19, 2016
Fishrock123 pushed a commit that referenced this pull request Oct 11, 2016
Replace equal with strictEqual, use const instead of var
Replace throw error with assert.ifError

PR-URL: #8577
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants