This repository was archived by the owner on Jul 21, 2023. It is now read-only.
File tree 1 file changed +15
-8
lines changed 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -210,18 +210,22 @@ describe('valid Connection', () => {
210
210
listener . listen ( ma , ( ) => {
211
211
const conn = ws . dial ( ma )
212
212
213
- conn . on ( 'end' , ( ) => {
213
+ conn . on ( 'end' , onEnd )
214
+
215
+ function onEnd ( ) {
214
216
conn . getObservedAddrs ( ( err , addrs ) => {
215
217
expect ( err ) . to . not . exist
216
218
listenerObsAddrs = addrs
217
219
218
- listener . close ( ( ) => {
220
+ listener . close ( onClose )
221
+
222
+ function onClose ( ) {
219
223
expect ( listenerObsAddrs [ 0 ] ) . to . deep . equal ( ma )
220
224
expect ( dialerObsAddrs . length ) . to . equal ( 0 )
221
225
done ( )
222
- } )
226
+ }
223
227
} )
224
- } )
228
+ }
225
229
conn . resume ( )
226
230
conn . end ( )
227
231
} )
@@ -243,12 +247,14 @@ describe('valid Connection', () => {
243
247
listener . listen ( ma , ( ) => {
244
248
const conn = ws . dial ( ma )
245
249
246
- conn . on ( 'end' , ( ) => {
250
+ conn . on ( 'end' , onEnd )
251
+
252
+ function onEnd ( ) {
247
253
conn . getPeerInfo ( ( err , peerInfo ) => {
248
254
expect ( err ) . to . exit
249
255
listener . close ( done )
250
256
} )
251
- } )
257
+ }
252
258
conn . resume ( )
253
259
conn . end ( )
254
260
} )
@@ -269,7 +275,8 @@ describe('valid Connection', () => {
269
275
conn . pipe ( conn )
270
276
} )
271
277
272
- listener . listen ( ma , ( ) => {
278
+ listener . listen ( ma , onListen )
279
+ function onListen ( ) {
273
280
const conn = ws . dial ( ma )
274
281
conn . setPeerInfo ( 'b' )
275
282
@@ -282,7 +289,7 @@ describe('valid Connection', () => {
282
289
} )
283
290
conn . resume ( )
284
291
conn . end ( )
285
- } )
292
+ }
286
293
} )
287
294
} )
288
295
You can’t perform that action at this time.
0 commit comments