@@ -81,9 +81,7 @@ TEST(async function test_resolve4_ttl(done) {
8181function validateResult ( result ) {
8282assert . ok ( result . length > 0 ) ;
8383
84- for ( let i = 0 ; i < result . length ; i ++ ) {
85- const item = result [ i ] ;
86- assert . ok ( item ) ;
84+ for ( const item of result ) {
8785assert . strictEqual ( typeof item , 'object' ) ;
8886assert . strictEqual ( typeof item . ttl , 'number' ) ;
8987assert . strictEqual ( typeof item . address , 'string' ) ;
@@ -111,9 +109,7 @@ TEST(async function test_resolve6_ttl(done) {
111109function validateResult ( result ) {
112110assert . ok ( result . length > 0 ) ;
113111
114- for ( let i = 0 ; i < result . length ; i ++ ) {
115- const item = result [ i ] ;
116- assert . ok ( item ) ;
112+ for ( const item of result ) {
117113assert . strictEqual ( typeof item , 'object' ) ;
118114assert . strictEqual ( typeof item . ttl , 'number' ) ;
119115assert . strictEqual ( typeof item . address , 'string' ) ;
@@ -141,9 +137,7 @@ TEST(async function test_resolveMx(done) {
141137function validateResult ( result ) {
142138assert . ok ( result . length > 0 ) ;
143139
144- for ( let i = 0 ; i < result . length ; i ++ ) {
145- const item = result [ i ] ;
146- assert . ok ( item ) ;
140+ for ( const item of result ) {
147141assert . strictEqual ( typeof item , 'object' ) ;
148142assert . ok ( item . exchange ) ;
149143assert . strictEqual ( typeof item . exchange , 'string' ) ;
@@ -183,9 +177,7 @@ TEST(async function test_resolveNs(done) {
183177function validateResult ( result ) {
184178assert . ok ( result . length > 0 ) ;
185179
186- for ( let i = 0 ; i < result . length ; i ++ ) {
187- const item = result [ i ] ;
188-
180+ for ( const item of result ) {
189181assert . ok ( item ) ;
190182assert . strictEqual ( typeof item , 'string' ) ;
191183}
@@ -223,14 +215,10 @@ TEST(async function test_resolveSrv(done) {
223215function validateResult ( result ) {
224216assert . ok ( result . length > 0 ) ;
225217
226- for ( let i = 0 ; i < result . length ; i ++ ) {
227- const item = result [ i ] ;
228- assert . ok ( item ) ;
218+ for ( const item of result ) {
229219assert . strictEqual ( typeof item , 'object' ) ;
230-
231220assert . ok ( item . name ) ;
232221assert . strictEqual ( typeof item . name , 'string' ) ;
233-
234222assert . strictEqual ( typeof item . port , 'number' ) ;
235223assert . strictEqual ( typeof item . priority , 'number' ) ;
236224assert . strictEqual ( typeof item . weight , 'number' ) ;
@@ -269,8 +257,7 @@ TEST(async function test_resolvePtr(done) {
269257function validateResult ( result ) {
270258assert . ok ( result . length > 0 ) ;
271259
272- for ( let i = 0 ; i < result . length ; i ++ ) {
273- const item = result [ i ] ;
260+ for ( const item of result ) {
274261assert . ok ( item ) ;
275262assert . strictEqual ( typeof item , 'string' ) ;
276263}
@@ -308,9 +295,7 @@ TEST(async function test_resolveNaptr(done) {
308295function validateResult ( result ) {
309296assert . ok ( result . length > 0 ) ;
310297
311- for ( let i = 0 ; i < result . length ; i ++ ) {
312- const item = result [ i ] ;
313- assert . ok ( item ) ;
298+ for ( const item of result ) {
314299assert . strictEqual ( typeof item , 'object' ) ;
315300assert . strictEqual ( typeof item . flags , 'string' ) ;
316301assert . strictEqual ( typeof item . service , 'string' ) ;
@@ -351,7 +336,6 @@ TEST(function test_resolveNaptr_failure(done) {
351336
352337TEST ( async function test_resolveSoa ( done ) {
353338function validateResult ( result ) {
354- assert . ok ( result ) ;
355339assert . strictEqual ( typeof result , 'object' ) ;
356340assert . strictEqual ( typeof result . nsname , 'string' ) ;
357341assert . ok ( result . nsname . length > 0 ) ;
@@ -401,10 +385,9 @@ TEST(async function test_resolveCname(done) {
401385function validateResult ( result ) {
402386assert . ok ( result . length > 0 ) ;
403387
404- for ( let i = 0 ; i < result . length ; i ++ ) {
405- const name = result [ i ] ;
406- assert . ok ( name ) ;
407- assert . strictEqual ( typeof name , 'string' ) ;
388+ for ( const item of result ) {
389+ assert . ok ( item ) ;
390+ assert . strictEqual ( typeof item , 'string' ) ;
408391}
409392}
410393
@@ -478,7 +461,7 @@ TEST(function test_lookup_failure(done) {
478461. then ( common . mustNotCall ( ) )
479462. catch ( common . expectsError ( { errno : dns . NOTFOUND } ) ) ;
480463
481- const req = dns . lookup ( addresses . INVALID_HOST , 4 , ( err , ip , family ) => {
464+ const req = dns . lookup ( addresses . INVALID_HOST , 4 , ( err ) => {
482465assert . ok ( err instanceof Error ) ;
483466assert . strictEqual ( err . errno , dns . NOTFOUND ) ;
484467assert . strictEqual ( err . errno , 'ENOTFOUND' ) ;
@@ -546,7 +529,7 @@ TEST(function test_lookup_ip_promise(done) {
546529TEST ( async function test_lookup_null_all ( done ) {
547530assert . deepStrictEqual ( await dnsPromises . lookup ( null , { all : true } ) , [ ] ) ;
548531
549- const req = dns . lookup ( null , { all : true } , function ( err , ips , family ) {
532+ const req = dns . lookup ( null , { all : true } , ( err , ips ) => {
550533assert . ifError ( err ) ;
551534assert . ok ( Array . isArray ( ips ) ) ;
552535assert . strictEqual ( ips . length , 0 ) ;
@@ -592,7 +575,7 @@ TEST(function test_lookupservice_invalid(done) {
592575. then ( common . mustNotCall ( ) )
593576. catch ( common . expectsError ( { code : 'ENOTFOUND' } ) ) ;
594577
595- const req = dns . lookupService ( '1.2.3.4' , 80 , function ( err , host , service ) {
578+ const req = dns . lookupService ( '1.2.3.4' , 80 , ( err ) => {
596579assert ( err instanceof Error ) ;
597580assert . strictEqual ( err . code , 'ENOTFOUND' ) ;
598581assert . ok ( / 1 \. 2 \. 3 \. 4 / . test ( err . message ) ) ;
0 commit comments