@@ -633,18 +633,32 @@ describe('new Connection()', function () {
633
633
expect ( driverSocket . end ) . to . have . been . calledOnce ;
634
634
} ) ;
635
635
636
- it ( 'does not call stream.end if options.force == true' , ( ) => {
637
- connection . destroy ( { force : true } ) ;
638
- clock . tick ( 1 ) ;
639
- expect ( driverSocket . destroy ) . to . have . been . calledOnce ;
640
- expect ( driverSocket . end ) . to . not . have . been . called ;
636
+ context ( 'when options.force == true' , function ( ) {
637
+ it ( 'calls steam.destroy' , ( ) => {
638
+ connection . destroy ( { force : true } ) ;
639
+ clock . tick ( 1 ) ;
640
+ expect ( driverSocket . destroy ) . to . have . been . calledOnce ;
641
+ } ) ;
642
+
643
+ it ( 'does not call stream.end' , ( ) => {
644
+ connection . destroy ( { force : true } ) ;
645
+ clock . tick ( 1 ) ;
646
+ expect ( driverSocket . end ) . to . not . have . been . called ;
647
+ } ) ;
641
648
} ) ;
642
649
643
- it ( 'does not call stream.destroy if options.force == false' , ( ) => {
644
- connection . destroy ( { force : false } ) ;
645
- clock . tick ( 1 ) ;
646
- expect ( driverSocket . destroy ) . to . not . have . been . called ;
647
- expect ( driverSocket . end ) . to . have . been . calledOnce ;
650
+ context ( 'when options.force == false' , function ( ) {
651
+ it ( 'calls stream.end' , ( ) => {
652
+ connection . destroy ( { force : false } ) ;
653
+ clock . tick ( 1 ) ;
654
+ expect ( driverSocket . end ) . to . have . been . calledOnce ;
655
+ } ) ;
656
+
657
+ it ( 'does not call stream.destroy' , ( ) => {
658
+ connection . destroy ( { force : false } ) ;
659
+ clock . tick ( 1 ) ;
660
+ expect ( driverSocket . destroy ) . to . not . have . been . called ;
661
+ } ) ;
648
662
} ) ;
649
663
} ) ;
650
664
} ) ;
0 commit comments