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 the code in test-dns-ipv4 #10200

Closed
wants to merge 1 commit into from

Conversation

edsadr
Copy link
Member

@edsadr edsadr commented Dec 9, 2016

Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

test

Description of change

use let and const instead of var
add missing common.mustCall for anonymous functions

@nodejs-github-bot nodejs-github-bot added test Issues and PRs related to the tests. lts-watch-v6.x labels Dec 9, 2016
@mscdex mscdex added the dns Issues and PRs related to the dns subsystem. label Dec 9, 2016
@mscdex
Copy link
Contributor

mscdex commented Dec 9, 2016

Can't we also get rid of the expected and completed variables now that we're using common.mustCall()?

@@ -39,119 +39,124 @@ function checkWrap(req) {
}

TEST(function test_resolve4(done) {
var req = dns.resolve4('www.google.com', function(err, ips) {
const req = dns.resolve4('www.google.com',
common.mustCall(function(err, ips) {
if (err) throw err;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you mind replacing all of these lines in the file with assert.ifError(err);

Copy link
Member Author

Choose a reason for hiding this comment

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

will perform these changes later tonight

@edsadr edsadr changed the title test: improve the code in test-dns-ipv4 test: refactor the code in test-dns-ipv4 Dec 10, 2016
@edsadr
Copy link
Member Author

edsadr commented Dec 10, 2016

@mscdex @cjihrig just applied the changes you requested

var req = dns.resolve4('www.google.com', function(err, ips) {
if (err) throw err;
const req = dns.resolve4('www.google.com',
common.mustCall(function(err, ips) {
Copy link
Contributor

@mscdex mscdex Dec 10, 2016

Choose a reason for hiding this comment

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

I'd rather either see this indented or use an arrow function to keep it on the previous line. If you go the arrow function route, we should be more consistent though and use it for the other callbacks too.

Same goes for the other instances below.

const assert = require('assert');
const common = require('../common');
Copy link
Contributor

Choose a reason for hiding this comment

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

common should be required before anything else.

Copy link
Member Author

Choose a reason for hiding this comment

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

will do this change too after get the #10219 approved, I am learning the right format for the code

* remove the manual control for functions execution
* use common.mustCall to control the functions execution automatically
* use let and const instead of var
* use assert.strictEqual instead assert.equal
@edsadr
Copy link
Member Author

edsadr commented Dec 20, 2016

changed the style to match the one agreed in #10219

@italoacasas
Copy link
Contributor

@edsadr
Copy link
Member Author

edsadr commented Dec 23, 2016

any update on this one?

@julianduque
Copy link
Contributor

@italoacasas
Copy link
Contributor

italoacasas commented Dec 23, 2016

landing this tomorrow if not objections @nodejs/collaboration

@gibfahn
Copy link
Member

gibfahn commented Dec 28, 2016

@italoacasas I think you meant @nodejs/collaborators

italoacasas pushed a commit that referenced this pull request Dec 28, 2016
* remove the manual control for functions execution
* use common.mustCall to control the functions execution automatically
* use let and const instead of var
* use assert.strictEqual instead assert.equal

PR-URL: #10200
Reviewed-By: Italo A. Casas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@italoacasas
Copy link
Contributor

Landed 4d3b487

evanlucas pushed a commit that referenced this pull request Jan 3, 2017
* remove the manual control for functions execution
* use common.mustCall to control the functions execution automatically
* use let and const instead of var
* use assert.strictEqual instead assert.equal

PR-URL: #10200
Reviewed-By: Italo A. Casas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
evanlucas pushed a commit that referenced this pull request Jan 4, 2017
* remove the manual control for functions execution
* use common.mustCall to control the functions execution automatically
* use let and const instead of var
* use assert.strictEqual instead assert.equal

PR-URL: #10200
Reviewed-By: Italo A. Casas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 23, 2017
* remove the manual control for functions execution
* use common.mustCall to control the functions execution automatically
* use let and const instead of var
* use assert.strictEqual instead assert.equal

PR-URL: #10200
Reviewed-By: Italo A. Casas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
MylesBorins pushed a commit that referenced this pull request Jan 24, 2017
* remove the manual control for functions execution
* use common.mustCall to control the functions execution automatically
* use let and const instead of var
* use assert.strictEqual instead assert.equal

PR-URL: #10200
Reviewed-By: Italo A. Casas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
@MylesBorins MylesBorins mentioned this pull request Jan 24, 2017
MylesBorins pushed a commit that referenced this pull request Jan 31, 2017
* remove the manual control for functions execution
* use common.mustCall to control the functions execution automatically
* use let and const instead of var
* use assert.strictEqual instead assert.equal

PR-URL: #10200
Reviewed-By: Italo A. Casas <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dns Issues and PRs related to the dns subsystem. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants