@@ -13,6 +13,7 @@ import * as network from './util/network';
13
13
describe ( 'test serve' , ( ) => {
14
14
let configResults : ServeConfig ;
15
15
let context : BuildContext ;
16
+ let openSpy : jasmine . Spy ;
16
17
17
18
beforeEach ( ( ) => {
18
19
context = {
@@ -43,7 +44,7 @@ describe('test serve', () => {
43
44
spyOn ( liveReloadServer , 'createLiveReloadServer' ) ;
44
45
spyOn ( httpServer , 'createHttpServer' ) ;
45
46
spyOn ( watch , 'watch' ) . and . returnValue ( Promise . resolve ( ) ) ;
46
- spyOn ( open , 'default' ) ;
47
+ openSpy = spyOn ( open , 'default' ) ;
47
48
} ) ;
48
49
49
50
it ( 'should work with no args on a happy path' , ( ) => {
@@ -52,7 +53,8 @@ describe('test serve', () => {
52
53
expect ( notificationServer . createNotificationServer ) . toHaveBeenCalledWith ( configResults ) ;
53
54
expect ( liveReloadServer . createLiveReloadServer ) . toHaveBeenCalledWith ( configResults ) ;
54
55
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 ) ;
56
58
} ) ;
57
59
} ) ;
58
60
@@ -65,7 +67,8 @@ describe('test serve', () => {
65
67
expect ( notificationServer . createNotificationServer ) . toHaveBeenCalledWith ( configResults ) ;
66
68
expect ( liveReloadServer . createLiveReloadServer ) . toHaveBeenCalledWith ( configResults ) ;
67
69
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 ) ;
69
72
} ) ;
70
73
} ) ;
71
74
@@ -103,7 +106,8 @@ describe('test serve', () => {
103
106
expect ( notificationServer . createNotificationServer ) . toHaveBeenCalledWith ( configResults ) ;
104
107
expect ( liveReloadServer . createLiveReloadServer ) . toHaveBeenCalledWith ( configResults ) ;
105
108
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' ) ;
107
111
} ) ;
108
112
} ) ;
109
113
} ) ;
0 commit comments