@@ -48,11 +48,11 @@ describe(NodeHttp2Handler.name, () => {
48
48
49
49
afterEach ( ( ) => {
50
50
// @ts -ignore: access private property
51
- const connectionPool = nodeH2Handler . connectionPool ;
52
- for ( const [ , session ] of connectionPool ) {
51
+ const sessionPool = nodeH2Handler . sessionPool ;
52
+ for ( const [ , session ] of sessionPool ) {
53
53
session . destroy ( ) ;
54
54
}
55
- connectionPool . clear ( ) ;
55
+ sessionPool . clear ( ) ;
56
56
} ) ;
57
57
58
58
it ( "has metadata" , ( ) => {
@@ -219,30 +219,30 @@ describe(NodeHttp2Handler.name, () => {
219
219
} ) ;
220
220
221
221
describe ( "destroy" , ( ) => {
222
- it ( "destroys session and clears connectionPool " , async ( ) => {
222
+ it ( "destroys session and clears sessionPool " , async ( ) => {
223
223
await nodeH2Handler . handle ( new HttpRequest ( getMockReqOptions ( ) ) , { } ) ;
224
224
225
225
// @ts -ignore: access private property
226
- const session : ClientHttp2Session = nodeH2Handler . connections [ 0 ] ;
226
+ const session : ClientHttp2Session = nodeH2Handler . sessions [ 0 ] ;
227
227
228
228
// @ts -ignore: access private property
229
- expect ( nodeH2Handler . connectionPool . size ) . toBe ( 1 ) ;
229
+ expect ( nodeH2Handler . sessionPool . size ) . toBe ( 1 ) ;
230
230
// @ts -ignore: access private property
231
- expect ( nodeH2Handler . connections . length ) . toBe ( 1 ) ;
231
+ expect ( nodeH2Handler . sessions . length ) . toBe ( 1 ) ;
232
232
expect ( session . destroyed ) . toBe ( false ) ;
233
233
nodeH2Handler . destroy ( ) ;
234
234
// @ts -ignore: access private property
235
- expect ( nodeH2Handler . connectionPool . size ) . toBe ( 0 ) ;
235
+ expect ( nodeH2Handler . sessionPool . size ) . toBe ( 0 ) ;
236
236
// @ts -ignore: access private property
237
- expect ( nodeH2Handler . connections . length ) . toBe ( 0 ) ;
237
+ expect ( nodeH2Handler . sessions . length ) . toBe ( 0 ) ;
238
238
expect ( session . destroyed ) . toBe ( true ) ;
239
239
} ) ;
240
240
} ) ;
241
241
242
242
describe ( "abortSignal" , ( ) => {
243
243
it ( "will not create session if request already aborted" , async ( ) => {
244
244
// @ts -ignore: access private property
245
- expect ( nodeH2Handler . connectionPool . size ) . toBe ( 0 ) ;
245
+ expect ( nodeH2Handler . sessionPool . size ) . toBe ( 0 ) ;
246
246
await expect (
247
247
nodeH2Handler . handle ( new HttpRequest ( getMockReqOptions ( ) ) , {
248
248
abortSignal : {
@@ -252,15 +252,15 @@ describe(NodeHttp2Handler.name, () => {
252
252
} )
253
253
) . rejects . toHaveProperty ( "name" , "AbortError" ) ;
254
254
// @ts -ignore: access private property
255
- expect ( nodeH2Handler . connectionPool . size ) . toBe ( 0 ) ;
255
+ expect ( nodeH2Handler . sessionPool . size ) . toBe ( 0 ) ;
256
256
} ) ;
257
257
258
258
it ( "will not create request on session if request already aborted" , async ( ) => {
259
259
// Create a session by sending a request.
260
260
await nodeH2Handler . handle ( new HttpRequest ( getMockReqOptions ( ) ) , { } ) ;
261
261
262
262
// @ts -ignore: access private property
263
- const session : ClientHttp2Session = nodeH2Handler . connections [ 0 ] ;
263
+ const session : ClientHttp2Session = nodeH2Handler . sessions [ 0 ] ;
264
264
const requestSpy = jest . spyOn ( session , "request" ) ;
265
265
266
266
await expect (
@@ -347,15 +347,15 @@ describe(NodeHttp2Handler.name, () => {
347
347
348
348
const authority = `${ protocol } //${ hostname } :${ port } ` ;
349
349
// @ts -ignore: access private property
350
- const session : ClientHttp2Session = nodeH2Handler . connections [ 0 ] ;
350
+ const session : ClientHttp2Session = nodeH2Handler . sessions [ 0 ] ;
351
351
expect ( session . closed ) . toBe ( false ) ;
352
352
// @ts -ignore: access private property
353
- expect ( nodeH2Handler . connectionPool . get ( authority ) ) . toBeDefined ( ) ;
353
+ expect ( nodeH2Handler . sessionPool . get ( authority ) ) . toBeDefined ( ) ;
354
354
setTimeout ( ( ) => {
355
355
expect ( session . closed ) . toBe ( true ) ;
356
356
expect ( session . destroyed ) . toBe ( false ) ;
357
357
// @ts -ignore: access private property
358
- expect ( nodeH2Handler . connectionPool . get ( authority ) ) . not . toBeDefined ( ) ;
358
+ expect ( nodeH2Handler . sessionPool . get ( authority ) ) . not . toBeDefined ( ) ;
359
359
done ( ) ;
360
360
} , sessionTimeout + 100 ) ;
361
361
} ) ;
@@ -365,7 +365,7 @@ describe(NodeHttp2Handler.name, () => {
365
365
await nodeH2Handler . handle ( new HttpRequest ( getMockReqOptions ( ) ) , { } ) ;
366
366
367
367
// @ts -ignore: access private property
368
- const session : ClientHttp2Session = nodeH2Handler . connections [ 0 ] ;
368
+ const session : ClientHttp2Session = nodeH2Handler . sessions [ 0 ] ;
369
369
expect ( session . closed ) . toBe ( false ) ;
370
370
setTimeout ( ( ) => {
371
371
expect ( session . closed ) . toBe ( true ) ;
@@ -439,14 +439,14 @@ describe(NodeHttp2Handler.name, () => {
439
439
await nodeH2Handler . handle ( new HttpRequest ( getMockReqOptions ( ) ) , { } ) ;
440
440
441
441
// @ts -ignore: access private property
442
- const session : ClientHttp2Session = nodeH2Handler . connections [ 0 ] ;
442
+ const session : ClientHttp2Session = nodeH2Handler . sessions [ 0 ] ;
443
443
444
444
// @ts -ignore: access private property
445
- expect ( nodeH2Handler . connections . length ) . toBe ( 1 ) ;
445
+ expect ( nodeH2Handler . sessions . length ) . toBe ( 1 ) ;
446
446
expect ( session . destroyed ) . toBe ( false ) ;
447
447
nodeH2Handler . destroy ( ) ;
448
448
// @ts -ignore: access private property
449
- expect ( nodeH2Handler . connections . length ) . toBe ( 0 ) ;
449
+ expect ( nodeH2Handler . sessions . length ) . toBe ( 0 ) ;
450
450
expect ( session . destroyed ) . toBe ( true ) ;
451
451
} ) ;
452
452
} ) ;
0 commit comments