Skip to content

Commit 53ad06e

Browse files
committed
test: improve test coverage of dns/promises
1 parent 03c9837 commit 53ad06e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Flags: --expose-internals
2+
'use strict';
3+
const common = require('../common');
4+
const { internalBinding } = require('internal/test/binding');
5+
const cares = internalBinding('cares_wrap');
6+
cares.getaddrinfo = () => internalBinding('uv').UV_ENOMEM;
7+
8+
// This test ensures that dns.lookup issue a DeprecationWarning
9+
// when invalid options type is given
10+
11+
const dns = require('dns');
12+
const dnsPromises = dns.promises;
13+
14+
common.expectWarning({
15+
'internal/test/binding': [
16+
'These APIs are for internal testing only. Do not use them.',
17+
],
18+
'DeprecationWarning': {
19+
DEP0153: 'Type coercion of dns.lookup options is deprecated'
20+
}
21+
});
22+
23+
dnsPromises.lookup('127.0.0.1', { hints: '1024' });
24+
dnsPromises.lookup('127.0.0.1', { family: '6' });
25+
dnsPromises.lookup('127.0.0.1', { all: 'true' });
26+
dnsPromises.lookup('127.0.0.1', { verbatim: 'true' });
27+
dnsPromises.lookup('127.0.0.1', '6');

0 commit comments

Comments
 (0)