@@ -44,14 +44,14 @@ async function download(httpsURL) {
44
44
} )
45
45
. once ( 'aborted' , reject )
46
46
. once ( 'close' , reject )
47
- . once ( 'error' , reject )
47
+ . once ( 'error' , reject ) ;
48
48
} ) ;
49
49
req . once ( 'error' , reject ) ;
50
50
} ) ;
51
51
}
52
52
53
53
test ( 'only http' , function ( t ) {
54
- t . plan ( 3 ) ;
54
+ t . plan ( 5 ) ;
55
55
createServers ( {
56
56
log : console . log ,
57
57
http : 9876 ,
@@ -61,6 +61,8 @@ test('only http', function (t) {
61
61
t . error ( err ) ;
62
62
t . equals ( typeof servers , 'object' ) ;
63
63
t . equals ( typeof servers . http , 'object' ) ;
64
+ t . equals ( servers . http instanceof Array , false ) ;
65
+ t . equals ( servers . https , undefined ) ;
64
66
servers . http . close ( ) ;
65
67
} ) ;
66
68
} ) ;
@@ -101,7 +103,7 @@ test('only http, timeout', function (t) {
101
103
} ) ;
102
104
103
105
test ( 'only https' , function ( t ) {
104
- t . plan ( 3 ) ;
106
+ t . plan ( 5 ) ;
105
107
createServers ( {
106
108
log : console . log ,
107
109
https : {
@@ -115,6 +117,8 @@ test('only https', function (t) {
115
117
t . error ( err ) ;
116
118
t . equals ( typeof servers , 'object' ) ;
117
119
t . equals ( typeof servers . https , 'object' ) ;
120
+ t . equals ( servers . https instanceof Array , false ) ;
121
+ t . equals ( servers . http , undefined ) ;
118
122
servers . https . close ( ) ;
119
123
} ) ;
120
124
} ) ;
@@ -149,7 +153,7 @@ test('absolute cert path resolution', function (t) {
149
153
port : 3456 ,
150
154
root : '/' ,
151
155
cert : path . resolve ( __dirname , 'fixtures' , 'example-org-cert.pem' ) ,
152
- key : path . resolve ( __dirname , 'fixtures' , 'example-org-key.pem' )
156
+ key : path . resolve ( __dirname , 'fixtures' , 'example-org-key.pem' )
153
157
} ,
154
158
handler : fend
155
159
} , function ( err , servers ) {
@@ -182,7 +186,7 @@ test('http && https', function (t) {
182
186
} ) ;
183
187
} ) ;
184
188
185
- test ( 'provides useful debug information' , async function ( t ) {
189
+ test ( 'provides useful debug information' , async function ( t ) {
186
190
t . plan ( 4 ) ;
187
191
188
192
const config = {
@@ -229,7 +233,7 @@ test('http && https with different handlers', function (t) {
229
233
root : path . join ( __dirname , 'fixtures' ) ,
230
234
key : 'example-org-key.pem' ,
231
235
cert : 'example-org-cert.pem'
232
- } ,
236
+ }
233
237
} , function ( err , servers ) {
234
238
t . error ( err ) ;
235
239
t . equals ( typeof servers , 'object' ) ;
@@ -282,7 +286,7 @@ test('supports cert contents instead of cert paths', function (t) {
282
286
port : 3456 ,
283
287
root : root ,
284
288
cert : fs . readFileSync ( path . resolve ( root , 'example-org-cert.pem' ) ) ,
285
- key : fs . readFileSync ( path . resolve ( root , 'example-org-key.pem' ) )
289
+ key : fs . readFileSync ( path . resolve ( root , 'example-org-key.pem' ) )
286
290
} ,
287
291
handler : fend
288
292
} , function ( err , servers ) {
@@ -317,15 +321,17 @@ test('supports creating certificate chains', function (t) {
317
321
t . plan ( 2 ) ;
318
322
var root = path . join ( __dirname , 'fixtures' ) ;
319
323
var agent3Cert = fs . readFileSync ( path . resolve ( root , 'agent3-cert.pem' ) ) ;
320
- var intermediate = fs . readFileSync ( path . resolve ( root , 'intermediate-cert.pem' ) ) ;
324
+ var intermediate = fs . readFileSync (
325
+ path . resolve ( root , 'intermediate-cert.pem' )
326
+ ) ;
321
327
var spy = sinon . spy ( https , 'createServer' ) ;
322
328
createServers ( {
323
329
log : console . log ,
324
330
https : {
325
331
port : 3456 ,
326
332
root : root ,
327
333
cert : [ 'agent3-cert.pem' , 'intermediate-cert.pem' ] ,
328
- key : 'agent3-key.pem'
334
+ key : 'agent3-key.pem'
329
335
} ,
330
336
handler : fend
331
337
} , function ( err , servers ) {
@@ -355,7 +361,11 @@ test('supports requestCert https option', function (t) {
355
361
handler : fend
356
362
} , function ( err , servers ) {
357
363
t . error ( err ) ;
358
- t . equals ( spy . lastCall . args [ 0 ] . requestCert , true , 'should preserve the requestCert option' ) ;
364
+ t . equals (
365
+ spy . lastCall . args [ 0 ] . requestCert ,
366
+ true ,
367
+ 'should preserve the requestCert option'
368
+ ) ;
359
369
servers . https . close ( ) ;
360
370
spy . restore ( ) ;
361
371
} ) ;
@@ -364,11 +374,7 @@ test('supports requestCert https option', function (t) {
364
374
test ( 'supports SNI' , async t => {
365
375
t . plan ( 1 ) ;
366
376
367
- const hostNames = [
368
- 'example.com' ,
369
- 'example.net' ,
370
- 'foo.example.org' ,
371
- ] ;
377
+ const hostNames = [ 'example.com' , 'example.net' , 'foo.example.org' ] ;
372
378
373
379
let httpsServer ;
374
380
try {
@@ -400,14 +406,15 @@ test('supports SNI', async t => {
400
406
401
407
hostNames . forEach ( host => evilDNS . add ( host , '0.0.0.0' ) ) ;
402
408
403
- const responses = await Promise . all ( hostNames
404
- . map ( hostname => download ( `https://${ hostname } :3456/` ) ) ) ;
409
+ const responses = await Promise . all (
410
+ hostNames . map ( hostname => download ( `https://${ hostname } :3456/` ) )
411
+ ) ;
405
412
406
413
t . equals (
407
414
responses . every ( str => str === 'Hello' ) ,
408
415
true ,
409
- 'responses are as expected' ) ;
410
-
416
+ 'responses are as expected'
417
+ ) ;
411
418
} catch ( err ) {
412
419
return void t . error ( err ) ;
413
420
} finally {
@@ -416,7 +423,7 @@ test('supports SNI', async t => {
416
423
}
417
424
} ) ;
418
425
419
- test ( 'multiple https servers' , async function ( t ) {
426
+ test ( 'multiple https servers' , async function ( t ) {
420
427
t . plan ( 2 ) ;
421
428
422
429
evilDNS . add ( 'foo.example.org' , '0.0.0.0' ) ;
0 commit comments