@@ -83,9 +83,7 @@ TEST(async function test_resolve4_ttl(done) {
8383function validateResult ( result ) {
8484assert . ok ( result . length > 0 ) ;
8585
86- for ( let i = 0 ; i < result . length ; i ++ ) {
87- const item = result [ i ] ;
88- assert . ok ( item ) ;
86+ for ( const item of result ) {
8987assert . strictEqual ( typeof item , 'object' ) ;
9088assert . strictEqual ( typeof item . ttl , 'number' ) ;
9189assert . strictEqual ( typeof item . address , 'string' ) ;
@@ -113,9 +111,7 @@ TEST(async function test_resolve6_ttl(done) {
113111function validateResult ( result ) {
114112assert . ok ( result . length > 0 ) ;
115113
116- for ( let i = 0 ; i < result . length ; i ++ ) {
117- const item = result [ i ] ;
118- assert . ok ( item ) ;
114+ for ( const item of result ) {
119115assert . strictEqual ( typeof item , 'object' ) ;
120116assert . strictEqual ( typeof item . ttl , 'number' ) ;
121117assert . strictEqual ( typeof item . address , 'string' ) ;
@@ -143,9 +139,7 @@ TEST(async function test_resolveMx(done) {
143139function validateResult ( result ) {
144140assert . ok ( result . length > 0 ) ;
145141
146- for ( let i = 0 ; i < result . length ; i ++ ) {
147- const item = result [ i ] ;
148- assert . ok ( item ) ;
142+ for ( const item of result ) {
149143assert . strictEqual ( typeof item , 'object' ) ;
150144assert . ok ( item . exchange ) ;
151145assert . strictEqual ( typeof item . exchange , 'string' ) ;
@@ -185,9 +179,7 @@ TEST(async function test_resolveNs(done) {
185179function validateResult ( result ) {
186180assert . ok ( result . length > 0 ) ;
187181
188- for ( let i = 0 ; i < result . length ; i ++ ) {
189- const item = result [ i ] ;
190-
182+ for ( const item of result ) {
191183assert . ok ( item ) ;
192184assert . strictEqual ( typeof item , 'string' ) ;
193185}
@@ -225,14 +217,10 @@ TEST(async function test_resolveSrv(done) {
225217function validateResult ( result ) {
226218assert . ok ( result . length > 0 ) ;
227219
228- for ( let i = 0 ; i < result . length ; i ++ ) {
229- const item = result [ i ] ;
230- assert . ok ( item ) ;
220+ for ( const item of result ) {
231221assert . strictEqual ( typeof item , 'object' ) ;
232-
233222assert . ok ( item . name ) ;
234223assert . strictEqual ( typeof item . name , 'string' ) ;
235-
236224assert . strictEqual ( typeof item . port , 'number' ) ;
237225assert . strictEqual ( typeof item . priority , 'number' ) ;
238226assert . strictEqual ( typeof item . weight , 'number' ) ;
@@ -271,8 +259,7 @@ TEST(async function test_resolvePtr(done) {
271259function validateResult ( result ) {
272260assert . ok ( result . length > 0 ) ;
273261
274- for ( let i = 0 ; i < result . length ; i ++ ) {
275- const item = result [ i ] ;
262+ for ( const item of result ) {
276263assert . ok ( item ) ;
277264assert . strictEqual ( typeof item , 'string' ) ;
278265}
@@ -310,9 +297,7 @@ TEST(async function test_resolveNaptr(done) {
310297function validateResult ( result ) {
311298assert . ok ( result . length > 0 ) ;
312299
313- for ( let i = 0 ; i < result . length ; i ++ ) {
314- const item = result [ i ] ;
315- assert . ok ( item ) ;
300+ for ( const item of result ) {
316301assert . strictEqual ( typeof item , 'object' ) ;
317302assert . strictEqual ( typeof item . flags , 'string' ) ;
318303assert . strictEqual ( typeof item . service , 'string' ) ;
@@ -353,7 +338,6 @@ TEST(function test_resolveNaptr_failure(done) {
353338
354339TEST ( async function test_resolveSoa ( done ) {
355340function validateResult ( result ) {
356- assert . ok ( result ) ;
357341assert . strictEqual ( typeof result , 'object' ) ;
358342assert . strictEqual ( typeof result . nsname , 'string' ) ;
359343assert . ok ( result . nsname . length > 0 ) ;
@@ -403,10 +387,9 @@ TEST(async function test_resolveCname(done) {
403387function validateResult ( result ) {
404388assert . ok ( result . length > 0 ) ;
405389
406- for ( let i = 0 ; i < result . length ; i ++ ) {
407- const name = result [ i ] ;
408- assert . ok ( name ) ;
409- assert . strictEqual ( typeof name , 'string' ) ;
390+ for ( const item of result ) {
391+ assert . ok ( item ) ;
392+ assert . strictEqual ( typeof item , 'string' ) ;
410393}
411394}
412395
@@ -480,7 +463,7 @@ TEST(function test_lookup_failure(done) {
480463. then ( common . mustNotCall ( ) )
481464. catch ( common . expectsError ( { errno : dns . NOTFOUND } ) ) ;
482465
483- const req = dns . lookup ( addresses . INVALID_HOST , 4 , ( err , ip , family ) => {
466+ const req = dns . lookup ( addresses . INVALID_HOST , 4 , ( err ) => {
484467assert . ok ( err instanceof Error ) ;
485468assert . strictEqual ( err . errno , dns . NOTFOUND ) ;
486469assert . strictEqual ( err . errno , 'ENOTFOUND' ) ;
@@ -548,7 +531,7 @@ TEST(function test_lookup_ip_promise(done) {
548531TEST ( async function test_lookup_null_all ( done ) {
549532assert . deepStrictEqual ( await dnsPromises . lookup ( null , { all : true } ) , [ ] ) ;
550533
551- const req = dns . lookup ( null , { all : true } , function ( err , ips , family ) {
534+ const req = dns . lookup ( null , { all : true } , ( err , ips ) => {
552535assert . ifError ( err ) ;
553536assert . ok ( Array . isArray ( ips ) ) ;
554537assert . strictEqual ( ips . length , 0 ) ;
@@ -594,7 +577,7 @@ TEST(function test_lookupservice_invalid(done) {
594577. then ( common . mustNotCall ( ) )
595578. catch ( common . expectsError ( { code : 'ENOTFOUND' } ) ) ;
596579
597- const req = dns . lookupService ( '1.2.3.4' , 80 , function ( err , host , service ) {
580+ const req = dns . lookupService ( '1.2.3.4' , 80 , ( err ) => {
598581assert ( err instanceof Error ) ;
599582assert . strictEqual ( err . code , 'ENOTFOUND' ) ;
600583assert . ok ( / 1 \. 2 \. 3 \. 4 / . test ( err . message ) ) ;
0 commit comments