Skip to content

Commit a197004

Browse files
committed
test: fix dns/promise import & hints type error
1 parent 1a19763 commit a197004

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

test/parallel/test-dns-lookup-promises-options-deprecated.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// Flags: --expose-internals
22
'use strict';
33
const common = require('../common');
4+
const assert = require('assert');
45
const { internalBinding } = require('internal/test/binding');
56
const cares = internalBinding('cares_wrap');
67
cares.getaddrinfo = () => internalBinding('uv').UV_ENOMEM;
78

89
// This test ensures that dns.lookup issue a DeprecationWarning
910
// when invalid options type is given
1011

11-
const dns = require('dns');
12-
const dnsPromises = dns.promises;
12+
const dnsPromises = require('dns/promises')
1313

1414
common.expectWarning({
1515
'internal/test/binding': [
@@ -20,7 +20,12 @@ common.expectWarning({
2020
}
2121
});
2222

23-
dnsPromises.lookup('127.0.0.1', { hints: '1024' });
23+
assert.throws(() => {
24+
dnsPromises.lookup('127.0.0.1', { hints: '-1' });
25+
}, {
26+
code: 'ERR_INVALID_ARG_VALUE',
27+
name: 'TypeError'
28+
});
2429
dnsPromises.lookup('127.0.0.1', { family: '6' });
2530
dnsPromises.lookup('127.0.0.1', { all: 'true' });
2631
dnsPromises.lookup('127.0.0.1', { verbatim: 'true' });

0 commit comments

Comments
 (0)