@@ -44,6 +44,12 @@ test('Should support H2 connection', async t => {
4444 } )
4545 after ( ( ) => client . close ( ) )
4646
47+ client . on ( 'disconnect' , ( ) => {
48+ if ( ! client . closed && ! client . destroyed ) {
49+ t . fail ( 'unexpected disconnect' )
50+ }
51+ } )
52+
4753 const response = await client . request ( {
4854 path : '/' ,
4955 method : 'GET' ,
@@ -98,6 +104,12 @@ test('Should support H2 connection(multiple requests)', async t => {
98104 } )
99105 after ( ( ) => client . close ( ) )
100106
107+ client . on ( 'disconnect' , ( ) => {
108+ if ( ! client . closed && ! client . destroyed ) {
109+ t . fail ( 'unexpected disconnect' )
110+ }
111+ } )
112+
101113 for ( let i = 0 ; i < 3 ; i ++ ) {
102114 const sendBody = `seq ${ i } `
103115 const body = [ ]
@@ -156,6 +168,12 @@ test('Should support H2 connection (headers as array)', async t => {
156168 } )
157169 after ( ( ) => client . close ( ) )
158170
171+ client . on ( 'disconnect' , ( ) => {
172+ if ( ! client . closed && ! client . destroyed ) {
173+ t . fail ( 'unexpected disconnect' )
174+ }
175+ } )
176+
159177 const response = await client . request ( {
160178 path : '/' ,
161179 method : 'GET' ,
@@ -215,6 +233,12 @@ test('Should support multiple header values with semicolon separator', async t =
215233 } )
216234 after ( ( ) => client . close ( ) )
217235
236+ client . on ( 'disconnect' , ( ) => {
237+ if ( ! client . closed && ! client . destroyed ) {
238+ t . fail ( 'unexpected disconnect' )
239+ }
240+ } )
241+
218242 const response = await client . request ( {
219243 path : '/' ,
220244 method : 'GET' ,
@@ -298,6 +322,12 @@ test('Should support H2 connection(POST Buffer)', async t => {
298322 } )
299323 after ( ( ) => client . close ( ) )
300324
325+ client . on ( 'disconnect' , ( ) => {
326+ if ( ! client . closed && ! client . destroyed ) {
327+ t . fail ( 'unexpected disconnect' )
328+ }
329+ } )
330+
301331 const sendBody = 'hello!'
302332 const body = [ ]
303333 const response = await client . request ( {
0 commit comments