@@ -13,6 +13,7 @@ import * as network from './util/network';
1313describe ( 'test serve' , ( ) => {
1414 let configResults : ServeConfig ;
1515 let context : BuildContext ;
16+ let openSpy : jasmine . Spy ;
1617
1718 beforeEach ( ( ) => {
1819 context = {
@@ -43,7 +44,7 @@ describe('test serve', () => {
4344 spyOn ( liveReloadServer , 'createLiveReloadServer' ) ;
4445 spyOn ( httpServer , 'createHttpServer' ) ;
4546 spyOn ( watch , 'watch' ) . and . returnValue ( Promise . resolve ( ) ) ;
46- spyOn ( open , 'default' ) ;
47+ openSpy = spyOn ( open , 'default' ) ;
4748 } ) ;
4849
4950 it ( 'should work with no args on a happy path' , ( ) => {
@@ -52,7 +53,8 @@ describe('test serve', () => {
5253 expect ( notificationServer . createNotificationServer ) . toHaveBeenCalledWith ( configResults ) ;
5354 expect ( liveReloadServer . createLiveReloadServer ) . toHaveBeenCalledWith ( configResults ) ;
5455 expect ( httpServer . createHttpServer ) . toHaveBeenCalledWith ( configResults ) ;
55- expect ( open . default ) . toHaveBeenCalledWith ( 'http://localhost:8100' , null ) ;
56+ expect ( openSpy . calls . mostRecent ( ) . args [ 0 ] ) . toEqual ( 'http://localhost:8100' ) ;
57+ expect ( openSpy . calls . mostRecent ( ) . args [ 1 ] ) . toEqual ( null ) ;
5658 } ) ;
5759 } ) ;
5860
@@ -65,7 +67,8 @@ describe('test serve', () => {
6567 expect ( notificationServer . createNotificationServer ) . toHaveBeenCalledWith ( configResults ) ;
6668 expect ( liveReloadServer . createLiveReloadServer ) . toHaveBeenCalledWith ( configResults ) ;
6769 expect ( httpServer . createHttpServer ) . toHaveBeenCalledWith ( configResults ) ;
68- expect ( open . default ) . toHaveBeenCalledWith ( 'http://localhost:8100?ionicplatform=android' , null ) ;
70+ expect ( openSpy . calls . mostRecent ( ) . args [ 0 ] ) . toEqual ( 'http://localhost:8100?ionicplatform=android' ) ;
71+ expect ( openSpy . calls . mostRecent ( ) . args [ 1 ] ) . toEqual ( null ) ;
6972 } ) ;
7073 } ) ;
7174
@@ -103,7 +106,8 @@ describe('test serve', () => {
103106 expect ( notificationServer . createNotificationServer ) . toHaveBeenCalledWith ( configResults ) ;
104107 expect ( liveReloadServer . createLiveReloadServer ) . toHaveBeenCalledWith ( configResults ) ;
105108 expect ( httpServer . createHttpServer ) . toHaveBeenCalledWith ( configResults ) ;
106- expect ( open . default ) . toHaveBeenCalledWith ( 'http://127.0.0.1:8101/ionic-lab' , 'safari' ) ;
109+ expect ( openSpy . calls . mostRecent ( ) . args [ 0 ] ) . toEqual ( 'http://127.0.0.1:8101/ionic-lab' ) ;
110+ expect ( openSpy . calls . mostRecent ( ) . args [ 1 ] ) . toEqual ( 'safari' ) ;
107111 } ) ;
108112 } ) ;
109113} ) ;
0 commit comments