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 () {
2104
2104
}
2105
2105
} ) ( ) ;
2106
2106
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 ) ;
2113
2118
2114
- await wait ( 0 ) ;
2115
2119
assert . equal ( eventList [ 0 ] . type , 'disconnect' ) ;
2116
2120
assert . equal ( eventList [ 1 ] . type , 'unsubscribe' ) ;
2117
2121
assert . equal ( eventList [ 1 ] . channel , 'foo' ) ;
@@ -2253,15 +2257,17 @@ describe('Integration tests', function () {
2253
2257
}
2254
2258
} ) ( ) ;
2255
2259
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
+ } ) ( ) ;
2263
2269
2264
- await wait ( 0 ) ;
2270
+ await wait ( 300 ) ;
2265
2271
assert . equal ( eventList [ 0 ] . type , 'disconnect' ) ;
2266
2272
assert . equal ( eventList [ 1 ] . type , 'unsubscribe' ) ;
2267
2273
assert . equal ( eventList [ 1 ] . channel , 'foo' ) ;
You can’t perform that action at this time.
0 commit comments