@@ -81,9 +81,7 @@ TEST(async function test_resolve4_ttl(done) {
81
81
function validateResult ( result ) {
82
82
assert . ok ( result . length > 0 ) ;
83
83
84
- for ( let i = 0 ; i < result . length ; i ++ ) {
85
- const item = result [ i ] ;
86
- assert . ok ( item ) ;
84
+ for ( const item of result ) {
87
85
assert . strictEqual ( typeof item , 'object' ) ;
88
86
assert . strictEqual ( typeof item . ttl , 'number' ) ;
89
87
assert . strictEqual ( typeof item . address , 'string' ) ;
@@ -111,9 +109,7 @@ TEST(async function test_resolve6_ttl(done) {
111
109
function validateResult ( result ) {
112
110
assert . ok ( result . length > 0 ) ;
113
111
114
- for ( let i = 0 ; i < result . length ; i ++ ) {
115
- const item = result [ i ] ;
116
- assert . ok ( item ) ;
112
+ for ( const item of result ) {
117
113
assert . strictEqual ( typeof item , 'object' ) ;
118
114
assert . strictEqual ( typeof item . ttl , 'number' ) ;
119
115
assert . strictEqual ( typeof item . address , 'string' ) ;
@@ -141,9 +137,7 @@ TEST(async function test_resolveMx(done) {
141
137
function validateResult ( result ) {
142
138
assert . ok ( result . length > 0 ) ;
143
139
144
- for ( let i = 0 ; i < result . length ; i ++ ) {
145
- const item = result [ i ] ;
146
- assert . ok ( item ) ;
140
+ for ( const item of result ) {
147
141
assert . strictEqual ( typeof item , 'object' ) ;
148
142
assert . ok ( item . exchange ) ;
149
143
assert . strictEqual ( typeof item . exchange , 'string' ) ;
@@ -183,9 +177,7 @@ TEST(async function test_resolveNs(done) {
183
177
function validateResult ( result ) {
184
178
assert . ok ( result . length > 0 ) ;
185
179
186
- for ( let i = 0 ; i < result . length ; i ++ ) {
187
- const item = result [ i ] ;
188
-
180
+ for ( const item of result ) {
189
181
assert . ok ( item ) ;
190
182
assert . strictEqual ( typeof item , 'string' ) ;
191
183
}
@@ -223,14 +215,10 @@ TEST(async function test_resolveSrv(done) {
223
215
function validateResult ( result ) {
224
216
assert . ok ( result . length > 0 ) ;
225
217
226
- for ( let i = 0 ; i < result . length ; i ++ ) {
227
- const item = result [ i ] ;
228
- assert . ok ( item ) ;
218
+ for ( const item of result ) {
229
219
assert . strictEqual ( typeof item , 'object' ) ;
230
-
231
220
assert . ok ( item . name ) ;
232
221
assert . strictEqual ( typeof item . name , 'string' ) ;
233
-
234
222
assert . strictEqual ( typeof item . port , 'number' ) ;
235
223
assert . strictEqual ( typeof item . priority , 'number' ) ;
236
224
assert . strictEqual ( typeof item . weight , 'number' ) ;
@@ -269,8 +257,7 @@ TEST(async function test_resolvePtr(done) {
269
257
function validateResult ( result ) {
270
258
assert . ok ( result . length > 0 ) ;
271
259
272
- for ( let i = 0 ; i < result . length ; i ++ ) {
273
- const item = result [ i ] ;
260
+ for ( const item of result ) {
274
261
assert . ok ( item ) ;
275
262
assert . strictEqual ( typeof item , 'string' ) ;
276
263
}
@@ -308,9 +295,7 @@ TEST(async function test_resolveNaptr(done) {
308
295
function validateResult ( result ) {
309
296
assert . ok ( result . length > 0 ) ;
310
297
311
- for ( let i = 0 ; i < result . length ; i ++ ) {
312
- const item = result [ i ] ;
313
- assert . ok ( item ) ;
298
+ for ( const item of result ) {
314
299
assert . strictEqual ( typeof item , 'object' ) ;
315
300
assert . strictEqual ( typeof item . flags , 'string' ) ;
316
301
assert . strictEqual ( typeof item . service , 'string' ) ;
@@ -351,7 +336,6 @@ TEST(function test_resolveNaptr_failure(done) {
351
336
352
337
TEST ( async function test_resolveSoa ( done ) {
353
338
function validateResult ( result ) {
354
- assert . ok ( result ) ;
355
339
assert . strictEqual ( typeof result , 'object' ) ;
356
340
assert . strictEqual ( typeof result . nsname , 'string' ) ;
357
341
assert . ok ( result . nsname . length > 0 ) ;
@@ -401,10 +385,9 @@ TEST(async function test_resolveCname(done) {
401
385
function validateResult ( result ) {
402
386
assert . ok ( result . length > 0 ) ;
403
387
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' ) ;
408
391
}
409
392
}
410
393
@@ -478,7 +461,7 @@ TEST(function test_lookup_failure(done) {
478
461
. then ( common . mustNotCall ( ) )
479
462
. catch ( common . expectsError ( { errno : dns . NOTFOUND } ) ) ;
480
463
481
- const req = dns . lookup ( addresses . INVALID_HOST , 4 , ( err , ip , family ) => {
464
+ const req = dns . lookup ( addresses . INVALID_HOST , 4 , ( err ) => {
482
465
assert . ok ( err instanceof Error ) ;
483
466
assert . strictEqual ( err . errno , dns . NOTFOUND ) ;
484
467
assert . strictEqual ( err . errno , 'ENOTFOUND' ) ;
@@ -546,7 +529,7 @@ TEST(function test_lookup_ip_promise(done) {
546
529
TEST ( async function test_lookup_null_all ( done ) {
547
530
assert . deepStrictEqual ( await dnsPromises . lookup ( null , { all : true } ) , [ ] ) ;
548
531
549
- const req = dns . lookup ( null , { all : true } , function ( err , ips , family ) {
532
+ const req = dns . lookup ( null , { all : true } , ( err , ips ) => {
550
533
assert . ifError ( err ) ;
551
534
assert . ok ( Array . isArray ( ips ) ) ;
552
535
assert . strictEqual ( ips . length , 0 ) ;
@@ -592,7 +575,7 @@ TEST(function test_lookupservice_invalid(done) {
592
575
. then ( common . mustNotCall ( ) )
593
576
. catch ( common . expectsError ( { code : 'ENOTFOUND' } ) ) ;
594
577
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 ) => {
596
579
assert ( err instanceof Error ) ;
597
580
assert . strictEqual ( err . code , 'ENOTFOUND' ) ;
598
581
assert . ok ( / 1 \. 2 \. 3 \. 4 / . test ( err . message ) ) ;
0 commit comments