GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — test: add tests for dnsPromises.lookup · nodejs/node@ae016c8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • test/parallel
    • test-dns-lookup.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/parallel/test-dns-lookup.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-dns-lookup.js
+25Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22
const common = require('../common');
3+
const { addresses } = require('../common/internet');
34
const assert = require('assert');
45
const cares = process.binding('cares_wrap');
56
const dns = require('dns');
@@ -92,6 +93,30 @@ common.expectsError(() => {
9293
all: false
9394
});
9495
assert.deepStrictEqual(res, { address: '127.0.0.1', family: 4 });
96+
97+
assert.rejects(
98+
dnsPromises.lookup(addresses.INVALID_HOST, {
99+
hints: 0,
100+
family: 0,
101+
all: false
102+
}),
103+
{
104+
code: 'ENOTFOUND',
105+
message: `getaddrinfo ENOTFOUND ${addresses.INVALID_HOST}`
106+
}
107+
);
108+
109+
assert.rejects(
110+
dnsPromises.lookup(addresses.INVALID_HOST, {
111+
hints: 0,
112+
family: 0,
113+
all: true
114+
}),
115+
{
116+
code: 'ENOTFOUND',
117+
message: `getaddrinfo ENOTFOUND ${addresses.INVALID_HOST}`
118+
}
119+
);
95120
})();
96121

97122
dns.lookup(false, {

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.