@@ -101,6 +101,10 @@ define(function (require, exports, module) {
101101 return { err : ERR_RETRY_LATER } ;
102102 }
103103 try {
104+ if ( Phoenix . isTestWindow && fetchFn === fetch ) {
105+ // so we never allow tests to hit the actual login service.
106+ return { err : ERR_INVALID } ;
107+ }
104108 const response = await fetchFn ( resolveURL ) ;
105109 if ( response . status === 400 || response . status === 404 ) {
106110 // 404 api key not found and 400 Bad Request, eg: verification code mismatch
@@ -195,6 +199,10 @@ define(function (require, exports, module) {
195199 const resolveURL = `${ Phoenix . config . account_url } getAppAuthSession?autoAuthPort=${ authPortURL } &appName=${ appName } ` ;
196200 // {"isSuccess":true,"appSessionID":"a uuid...","validationCode":"SWXP07"}
197201 try {
202+ if ( Phoenix . isTestWindow && fetchFn === fetch ) {
203+ // so we never allow tests to hit the actual login service.
204+ return null ;
205+ }
198206 const response = await fetchFn ( resolveURL ) ;
199207 if ( response . ok ) {
200208 const { appSessionID, validationCode} = await response . json ( ) ;
@@ -348,6 +356,10 @@ define(function (require, exports, module) {
348356 appSessionID : userProfile . apiKey
349357 } ;
350358
359+ if ( Phoenix . isTestWindow && fetchFn === fetch ) {
360+ // so we never allow tests to hit the actual login service.
361+ return ;
362+ }
351363 const response = await fetchFn ( resolveURL , {
352364 method : 'POST' ,
353365 headers : {
0 commit comments