@@ -45,6 +45,12 @@ test('Dispatcher#Stream', async t => {
4545 } )
4646 after ( ( ) => client . close ( ) )
4747
48+ client . on ( 'disconnect' , ( ) => {
49+ if ( ! client . closed && ! client . destroyed ) {
50+ t . fail ( 'unexpected disconnect' )
51+ }
52+ } )
53+
4854 await client . stream (
4955 { path : '/' , opaque : { bufs } , method : 'POST' , body : expectedBody } ,
5056 ( { statusCode, headers, opaque : { bufs } } ) => {
@@ -99,6 +105,12 @@ test('Dispatcher#Pipeline', async t => {
99105 } )
100106 after ( ( ) => client . close ( ) )
101107
108+ client . on ( 'disconnect' , ( ) => {
109+ if ( ! client . closed && ! client . destroyed ) {
110+ t . fail ( 'unexpected disconnect' )
111+ }
112+ } )
113+
102114 pipeline (
103115 new Readable ( {
104116 read ( ) {
@@ -159,6 +171,12 @@ test('Dispatcher#Connect', async t => {
159171 } )
160172 after ( ( ) => forward . close ( ) )
161173
174+ forward . on ( 'disconnect' , ( ) => {
175+ if ( ! forward . closed && ! forward . destroyed ) {
176+ t . fail ( 'unexpected disconnect' )
177+ }
178+ } )
179+
162180 try {
163181 const response = await forward . request ( {
164182 path : '/' ,
@@ -206,6 +224,12 @@ test('Dispatcher#Connect', async t => {
206224 after ( ( ) => proxy . close ( ) )
207225 after ( ( ) => server . close ( ) )
208226
227+ client . on ( 'disconnect' , ( ) => {
228+ if ( ! client . closed && ! client . destroyed ) {
229+ t . fail ( 'unexpected disconnect' )
230+ }
231+ } )
232+
209233 const { statusCode, headers, socket } = await client . connect ( { path : '/' , headers : { 'x-my-header' : 'foo' } } )
210234 t . strictEqual ( statusCode , 200 )
211235 t . strictEqual ( headers [ 'x-my-header' ] , 'foo' )
@@ -589,6 +613,12 @@ test('Should handle h2 request without body', async t => {
589613 } )
590614 after ( ( ) => client . close ( ) )
591615
616+ client . on ( 'disconnect' , ( ) => {
617+ if ( ! client . closed && ! client . destroyed ) {
618+ t . fail ( 'unexpected disconnect' )
619+ }
620+ } )
621+
592622 const response = await client . request ( {
593623 path : '/' ,
594624 method : 'POST' ,
@@ -635,6 +665,12 @@ test('Should clear h2 request stream references before completing a response', a
635665 } )
636666 after ( ( ) => client . close ( ) )
637667
668+ client . on ( 'disconnect' , ( ) => {
669+ if ( ! client . closed && ! client . destroyed ) {
670+ t . fail ( 'unexpected disconnect' )
671+ }
672+ } )
673+
638674 let requestStreamIdSymbol = null
639675 let requestStreamSymbol = null
640676 let requestStreamCleanupSymbol = null
@@ -925,6 +961,12 @@ test('Should send http2 PING frames', async t => {
925961 server . close ( )
926962 } )
927963
964+ client . on ( 'disconnect' , ( ) => {
965+ if ( ! client . closed && ! client . destroyed ) {
966+ t . fail ( 'unexpected disconnect' )
967+ }
968+ } )
969+
928970 client . dispatch ( {
929971 path : '/' ,
930972 method : 'PUT' ,
@@ -996,6 +1038,12 @@ test('Should not send http2 PING frames if interval === 0', async t => {
9961038 server . close ( )
9971039 } )
9981040
1041+ client . on ( 'disconnect' , ( ) => {
1042+ if ( ! client . closed && ! client . destroyed ) {
1043+ t . fail ( 'unexpected disconnect' )
1044+ }
1045+ } )
1046+
9991047 client . dispatch ( {
10001048 path : '/' ,
10011049 method : 'PUT' ,
@@ -1068,6 +1116,12 @@ test('Should not send http2 PING frames after connection is closed', async t =>
10681116 server . close ( )
10691117 } )
10701118
1119+ client . on ( 'disconnect' , ( ) => {
1120+ if ( ! client . closed && ! client . destroyed ) {
1121+ t . fail ( 'unexpected disconnect' )
1122+ }
1123+ } )
1124+
10711125 client . dispatch ( {
10721126 path : '/' ,
10731127 method : 'PUT' ,
0 commit comments