File tree Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Expand file tree Collapse file tree 1 file changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -2104,14 +2104,18 @@ describe('Integration tests', function () {
21042104 }
21052105 } ) ( ) ;
21062106
2107- let disconnectPacket = await socket . listener ( 'disconnect' ) . once ( ) ;
2108- eventList . push ( {
2109- type : 'disconnect' ,
2110- code : disconnectPacket . code ,
2111- reason : disconnectPacket . data
2112- } ) ;
2107+ ( async ( ) => {
2108+ for await ( let disconnectPacket of socket . listener ( 'disconnect' ) ) {
2109+ eventList . push ( {
2110+ type : 'disconnect' ,
2111+ code : disconnectPacket . code ,
2112+ reason : disconnectPacket . data
2113+ } ) ;
2114+ }
2115+ } ) ( ) ;
2116+
2117+ await wait ( 300 ) ;
21132118
2114- await wait ( 0 ) ;
21152119 assert . equal ( eventList [ 0 ] . type , 'disconnect' ) ;
21162120 assert . equal ( eventList [ 1 ] . type , 'unsubscribe' ) ;
21172121 assert . equal ( eventList [ 1 ] . channel , 'foo' ) ;
@@ -2253,15 +2257,17 @@ describe('Integration tests', function () {
22532257 }
22542258 } ) ( ) ;
22552259
2256- let event = await socket . listener ( 'disconnect' ) . once ( ) ;
2257-
2258- eventList . push ( {
2259- type : 'disconnect' ,
2260- code : event . code ,
2261- reason : event . reason
2262- } ) ;
2260+ ( async ( ) => {
2261+ for await ( let event of socket . listener ( 'disconnect' ) ) {
2262+ eventList . push ( {
2263+ type : 'disconnect' ,
2264+ code : event . code ,
2265+ reason : event . reason
2266+ } ) ;
2267+ }
2268+ } ) ( ) ;
22632269
2264- await wait ( 0 ) ;
2270+ await wait ( 300 ) ;
22652271 assert . equal ( eventList [ 0 ] . type , 'disconnect' ) ;
22662272 assert . equal ( eventList [ 1 ] . type , 'unsubscribe' ) ;
22672273 assert . equal ( eventList [ 1 ] . channel , 'foo' ) ;
You can’t perform that action at this time.
0 commit comments