@@ -258,6 +258,14 @@ describe('SSO organization transitions', () => {
258258
259259 it ( 'shows a billing failure instead of an Enterprise upsell' , ( ) => {
260260 const refetch = vi . fn ( )
261+ const refetchProviders = vi . fn ( )
262+ mockUseSSOProviders . mockReturnValue ( {
263+ data : { providers : [ provider ( 'org-a' ) ] } ,
264+ error : null ,
265+ isFetching : true ,
266+ isLoading : false ,
267+ refetch : refetchProviders ,
268+ } )
261269 mockUseOrganizationBilling . mockReturnValue ( {
262270 data : undefined ,
263271 error : new Error ( 'Billing entitlement failed' ) ,
@@ -270,12 +278,22 @@ describe('SSO organization transitions', () => {
270278
271279 expect ( container ) . toHaveTextContent ( 'Billing entitlement failed' )
272280 expect ( container ) . not . toHaveTextContent ( 'available on Enterprise plans only' )
281+ expect ( findButton ( 'Try again' ) ) . not . toBeDisabled ( )
273282 act ( ( ) => findButton ( 'Try again' ) ?. click ( ) )
274283 expect ( refetch ) . toHaveBeenCalledOnce ( )
284+ expect ( refetchProviders ) . not . toHaveBeenCalled ( )
275285 } )
276286
277287 it ( 'retries an initial provider failure without leaving the page' , ( ) => {
278288 const refetch = vi . fn ( )
289+ const refetchBilling = vi . fn ( )
290+ mockUseOrganizationBilling . mockReturnValue ( {
291+ data : { data : { subscriptionPlan : 'enterprise' } } ,
292+ error : null ,
293+ isFetching : true ,
294+ isLoading : false ,
295+ refetch : refetchBilling ,
296+ } )
279297 mockUseSSOProviders . mockReturnValue ( {
280298 data : undefined ,
281299 error : new Error ( 'Provider lookup failed' ) ,
@@ -287,8 +305,10 @@ describe('SSO organization transitions', () => {
287305 renderSso ( 'org-a' )
288306
289307 expect ( container ) . toHaveTextContent ( 'Provider lookup failed' )
308+ expect ( findButton ( 'Try again' ) ) . not . toBeDisabled ( )
290309 act ( ( ) => findButton ( 'Try again' ) ?. click ( ) )
291310 expect ( refetch ) . toHaveBeenCalledOnce ( )
311+ expect ( refetchBilling ) . not . toHaveBeenCalled ( )
292312 } )
293313} )
294314
0 commit comments