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: add dns.onlookupall() error test to increase coverage #22985

Closed
wants to merge 1 commit into from

Conversation

shisama
Copy link
Contributor

@shisama shisama commented Sep 21, 2018

Added test that callback should be called when error occurs in dns.lookupall().

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Added test that callback should be called when error occurs in dns.lookupall().
@nodejs-github-bot nodejs-github-bot added the test Issues and PRs related to the tests. label Sep 21, 2018
@addaleax addaleax added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 24, 2018
@addaleax
Copy link
Member

@trivikr
Copy link
Member

trivikr commented Sep 25, 2018

);
assert.strictEqual(error.syscall, 'getaddrinfo');
assert.strictEqual(error.hostname, addresses.INVALID_HOST);
}));
Copy link
Member

Choose a reason for hiding this comment

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

As a hint: it would be easier to write this as:

assert.throws(
  () => dns.lookup(addresses.INVALID_HOST, {
    hints: 0,
    family: 0,
    all: true
  }),
  {
    code: 'ENOTFOUND',
    message: 'getaddrinfo ENOTFOUND ...',
    syscall: 'getaddrinfo',
    hostname: addresses.INVALID_HOST
  }
);

@danbev
Copy link
Contributor

danbev commented Sep 27, 2018

Landed in a58f377.

@danbev danbev closed this Sep 27, 2018
danbev pushed a commit that referenced this pull request Sep 27, 2018
Added test that callback should be called when error occurs
in dns.lookupall().

PR-URL: #22985
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
targos pushed a commit that referenced this pull request Sep 27, 2018
Added test that callback should be called when error occurs
in dns.lookupall().

PR-URL: #22985
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants