@@ -88,21 +88,23 @@ describe('lib/gui/auth', function () {
88
88
} )
89
89
90
90
it ( 'returns a promise that is fulfilled when openExternal succeeds' , function ( ) {
91
- sinon . stub ( electron . shell , 'openExternal' ) . callsArg ( 2 )
91
+ sinon . stub ( electron . shell , 'openExternal' ) . resolves ( )
92
+ const sendWarning = sinon . stub ( )
92
93
93
- return auth . _launchNativeAuth ( REDIRECT_URL )
94
+ return auth . _launchNativeAuth ( REDIRECT_URL , sendWarning )
94
95
. then ( ( ) => {
95
- expect ( electron . shell . openExternal ) . to . be . calledWithMatch ( REDIRECT_URL , { } , sinon . match . func )
96
+ expect ( electron . shell . openExternal ) . to . be . calledWithMatch ( REDIRECT_URL )
97
+ expect ( sendWarning ) . to . not . be . called
96
98
} )
97
99
} )
98
100
99
101
it ( 'is still fulfilled when openExternal fails, but sendWarning is called' , function ( ) {
100
- sinon . stub ( electron . shell , 'openExternal' ) . callsArgWith ( 2 , new Error )
102
+ sinon . stub ( electron . shell , 'openExternal' ) . rejects ( new Error )
101
103
const sendWarning = sinon . stub ( )
102
104
103
105
return auth . _launchNativeAuth ( REDIRECT_URL , sendWarning )
104
106
. then ( ( ) => {
105
- expect ( electron . shell . openExternal ) . to . be . calledWithMatch ( REDIRECT_URL , { } , sinon . match . func )
107
+ expect ( electron . shell . openExternal ) . to . be . calledWithMatch ( REDIRECT_URL )
106
108
expect ( sendWarning ) . to . be . calledWithMatch ( 'warning' , 'AUTH_COULD_NOT_LAUNCH_BROWSER' , REDIRECT_URL )
107
109
} )
108
110
} )
0 commit comments