File tree 1 file changed +8
-3
lines changed
1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
1
// Flags: --expose-internals
2
2
'use strict' ;
3
3
const common = require ( '../common' ) ;
4
+ const assert = require ( 'assert' ) ;
4
5
const { internalBinding } = require ( 'internal/test/binding' ) ;
5
6
const cares = internalBinding ( 'cares_wrap' ) ;
6
7
cares . getaddrinfo = ( ) => internalBinding ( 'uv' ) . UV_ENOMEM ;
7
8
8
9
// This test ensures that dns.lookup issue a DeprecationWarning
9
10
// when invalid options type is given
10
11
11
- const dns = require ( 'dns' ) ;
12
- const dnsPromises = dns . promises ;
12
+ const dnsPromises = require ( 'dns/promises' )
13
13
14
14
common . expectWarning ( {
15
15
'internal/test/binding' : [
@@ -20,7 +20,12 @@ common.expectWarning({
20
20
}
21
21
} ) ;
22
22
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
+ } ) ;
24
29
dnsPromises . lookup ( '127.0.0.1' , { family : '6' } ) ;
25
30
dnsPromises . lookup ( '127.0.0.1' , { all : 'true' } ) ;
26
31
dnsPromises . lookup ( '127.0.0.1' , { verbatim : 'true' } ) ;
You can’t perform that action at this time.
0 commit comments