@@ -83,9 +83,7 @@ TEST(async function test_resolve4_ttl(done) {
83
83
function validateResult ( result ) {
84
84
assert . ok ( result . length > 0 ) ;
85
85
86
- for ( let i = 0 ; i < result . length ; i ++ ) {
87
- const item = result [ i ] ;
88
- assert . ok ( item ) ;
86
+ for ( const item of result ) {
89
87
assert . strictEqual ( typeof item , 'object' ) ;
90
88
assert . strictEqual ( typeof item . ttl , 'number' ) ;
91
89
assert . strictEqual ( typeof item . address , 'string' ) ;
@@ -113,9 +111,7 @@ TEST(async function test_resolve6_ttl(done) {
113
111
function validateResult ( result ) {
114
112
assert . ok ( result . length > 0 ) ;
115
113
116
- for ( let i = 0 ; i < result . length ; i ++ ) {
117
- const item = result [ i ] ;
118
- assert . ok ( item ) ;
114
+ for ( const item of result ) {
119
115
assert . strictEqual ( typeof item , 'object' ) ;
120
116
assert . strictEqual ( typeof item . ttl , 'number' ) ;
121
117
assert . strictEqual ( typeof item . address , 'string' ) ;
@@ -143,9 +139,7 @@ TEST(async function test_resolveMx(done) {
143
139
function validateResult ( result ) {
144
140
assert . ok ( result . length > 0 ) ;
145
141
146
- for ( let i = 0 ; i < result . length ; i ++ ) {
147
- const item = result [ i ] ;
148
- assert . ok ( item ) ;
142
+ for ( const item of result ) {
149
143
assert . strictEqual ( typeof item , 'object' ) ;
150
144
assert . ok ( item . exchange ) ;
151
145
assert . strictEqual ( typeof item . exchange , 'string' ) ;
@@ -185,9 +179,7 @@ TEST(async function test_resolveNs(done) {
185
179
function validateResult ( result ) {
186
180
assert . ok ( result . length > 0 ) ;
187
181
188
- for ( let i = 0 ; i < result . length ; i ++ ) {
189
- const item = result [ i ] ;
190
-
182
+ for ( const item of result ) {
191
183
assert . ok ( item ) ;
192
184
assert . strictEqual ( typeof item , 'string' ) ;
193
185
}
@@ -225,14 +217,10 @@ TEST(async function test_resolveSrv(done) {
225
217
function validateResult ( result ) {
226
218
assert . ok ( result . length > 0 ) ;
227
219
228
- for ( let i = 0 ; i < result . length ; i ++ ) {
229
- const item = result [ i ] ;
230
- assert . ok ( item ) ;
220
+ for ( const item of result ) {
231
221
assert . strictEqual ( typeof item , 'object' ) ;
232
-
233
222
assert . ok ( item . name ) ;
234
223
assert . strictEqual ( typeof item . name , 'string' ) ;
235
-
236
224
assert . strictEqual ( typeof item . port , 'number' ) ;
237
225
assert . strictEqual ( typeof item . priority , 'number' ) ;
238
226
assert . strictEqual ( typeof item . weight , 'number' ) ;
@@ -271,8 +259,7 @@ TEST(async function test_resolvePtr(done) {
271
259
function validateResult ( result ) {
272
260
assert . ok ( result . length > 0 ) ;
273
261
274
- for ( let i = 0 ; i < result . length ; i ++ ) {
275
- const item = result [ i ] ;
262
+ for ( const item of result ) {
276
263
assert . ok ( item ) ;
277
264
assert . strictEqual ( typeof item , 'string' ) ;
278
265
}
@@ -310,9 +297,7 @@ TEST(async function test_resolveNaptr(done) {
310
297
function validateResult ( result ) {
311
298
assert . ok ( result . length > 0 ) ;
312
299
313
- for ( let i = 0 ; i < result . length ; i ++ ) {
314
- const item = result [ i ] ;
315
- assert . ok ( item ) ;
300
+ for ( const item of result ) {
316
301
assert . strictEqual ( typeof item , 'object' ) ;
317
302
assert . strictEqual ( typeof item . flags , 'string' ) ;
318
303
assert . strictEqual ( typeof item . service , 'string' ) ;
@@ -353,7 +338,6 @@ TEST(function test_resolveNaptr_failure(done) {
353
338
354
339
TEST ( async function test_resolveSoa ( done ) {
355
340
function validateResult ( result ) {
356
- assert . ok ( result ) ;
357
341
assert . strictEqual ( typeof result , 'object' ) ;
358
342
assert . strictEqual ( typeof result . nsname , 'string' ) ;
359
343
assert . ok ( result . nsname . length > 0 ) ;
@@ -403,10 +387,9 @@ TEST(async function test_resolveCname(done) {
403
387
function validateResult ( result ) {
404
388
assert . ok ( result . length > 0 ) ;
405
389
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' ) ;
410
393
}
411
394
}
412
395
@@ -480,7 +463,7 @@ TEST(function test_lookup_failure(done) {
480
463
. then ( common . mustNotCall ( ) )
481
464
. catch ( common . expectsError ( { errno : dns . NOTFOUND } ) ) ;
482
465
483
- const req = dns . lookup ( addresses . INVALID_HOST , 4 , ( err , ip , family ) => {
466
+ const req = dns . lookup ( addresses . INVALID_HOST , 4 , ( err ) => {
484
467
assert . ok ( err instanceof Error ) ;
485
468
assert . strictEqual ( err . errno , dns . NOTFOUND ) ;
486
469
assert . strictEqual ( err . errno , 'ENOTFOUND' ) ;
@@ -548,7 +531,7 @@ TEST(function test_lookup_ip_promise(done) {
548
531
TEST ( async function test_lookup_null_all ( done ) {
549
532
assert . deepStrictEqual ( await dnsPromises . lookup ( null , { all : true } ) , [ ] ) ;
550
533
551
- const req = dns . lookup ( null , { all : true } , function ( err , ips , family ) {
534
+ const req = dns . lookup ( null , { all : true } , ( err , ips ) => {
552
535
assert . ifError ( err ) ;
553
536
assert . ok ( Array . isArray ( ips ) ) ;
554
537
assert . strictEqual ( ips . length , 0 ) ;
@@ -594,7 +577,7 @@ TEST(function test_lookupservice_invalid(done) {
594
577
. then ( common . mustNotCall ( ) )
595
578
. catch ( common . expectsError ( { code : 'ENOTFOUND' } ) ) ;
596
579
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 ) => {
598
581
assert ( err instanceof Error ) ;
599
582
assert . strictEqual ( err . code , 'ENOTFOUND' ) ;
600
583
assert . ok ( / 1 \. 2 \. 3 \. 4 / . test ( err . message ) ) ;
0 commit comments