@@ -87,9 +87,8 @@ describe('ClientProxy', function() {
8787 expect ( stream$ instanceof Observable ) . to . be . true ;
8888 } ) ;
8989 it ( 'should call "connect" on subscribe' , ( ) => {
90- const connectSpy = sinon . spy ( ) ;
90+ const connectSpy = sinon . spy ( client , 'connect' ) ;
9191 const stream$ = client . send ( { test : 3 } , 'test' ) ;
92- client . connect = connectSpy ;
9392
9493 stream$ . subscribe ( ) ;
9594 expect ( connectSpy . calledOnce ) . to . be . true ;
@@ -110,9 +109,7 @@ describe('ClientProxy', function() {
110109 } ) ;
111110 describe ( 'when is connected' , ( ) => {
112111 beforeEach ( ( ) => {
113- try {
114- sinon . stub ( client , 'connect' ) . callsFake ( ( ) => Promise . resolve ( ) ) ;
115- } catch { }
112+ sinon . stub ( client , 'connect' ) . callsFake ( ( ) => Promise . resolve ( ) ) ;
116113 } ) ;
117114 it ( `should call "publish"` , ( ) => {
118115 const pattern = { test : 3 } ;
@@ -138,9 +135,7 @@ describe('ClientProxy', function() {
138135 expect ( stream$ instanceof Observable ) . to . be . true ;
139136 } ) ;
140137 it ( 'should call "connect" immediately' , ( ) => {
141- const connectSpy = sinon . spy ( ) ;
142- client . connect = connectSpy ;
143-
138+ const connectSpy = sinon . spy ( client , 'connect' ) ;
144139 client . emit ( { test : 3 } , 'test' ) ;
145140 expect ( connectSpy . calledOnce ) . to . be . true ;
146141 } ) ;
0 commit comments