@@ -48,6 +48,7 @@ describe('UsageOverview', () => {
4848 usageData = { usageData }
4949 />
5050 ) ;
51+ expect ( screen . getAllByRole ( 'columnheader' ) ) . toHaveLength ( 6 ) ;
5152 expect ( screen . getByRole ( 'columnheader' , { name : 'Product' } ) ) . toBeInTheDocument ( ) ;
5253 expect ( screen . getByRole ( 'columnheader' , { name : 'Total usage' } ) ) . toBeInTheDocument ( ) ;
5354 expect ( screen . getByRole ( 'columnheader' , { name : 'Reserved' } ) ) . toBeInTheDocument ( ) ;
@@ -73,6 +74,7 @@ describe('UsageOverview', () => {
7374 usageData = { usageData }
7475 />
7576 ) ;
77+ expect ( screen . getAllByRole ( 'columnheader' ) ) . toHaveLength ( 6 ) ;
7678 expect ( screen . getByRole ( 'columnheader' , { name : 'Product' } ) ) . toBeInTheDocument ( ) ;
7779 expect ( screen . getByRole ( 'columnheader' , { name : 'Total usage' } ) ) . toBeInTheDocument ( ) ;
7880 expect ( screen . getByRole ( 'columnheader' , { name : 'Reserved' } ) ) . toBeInTheDocument ( ) ;
@@ -93,6 +95,54 @@ describe('UsageOverview', () => {
9395 ) ;
9496 } ) ;
9597
98+ it ( 'renders some spend columns for non-self-serve with PAYG support' , ( ) => {
99+ const newSubscription = SubscriptionFixture ( {
100+ organization,
101+ plan : 'am3_business' ,
102+ supportsOnDemand : true ,
103+ canSelfServe : false ,
104+ } ) ;
105+ SubscriptionStore . set ( organization . slug , newSubscription ) ;
106+ render (
107+ < UsageOverview
108+ subscription = { newSubscription }
109+ organization = { organization }
110+ usageData = { usageData }
111+ />
112+ ) ;
113+ expect ( screen . getAllByRole ( 'columnheader' ) ) . toHaveLength ( 5 ) ;
114+ expect (
115+ screen . queryByRole ( 'columnheader' , { name : 'Reserved spend' } )
116+ ) . not . toBeInTheDocument ( ) ;
117+ expect (
118+ screen . getByRole ( 'columnheader' , { name : 'Pay-as-you-go spend' } )
119+ ) . toBeInTheDocument ( ) ;
120+ } ) ;
121+
122+ it ( 'does not render spend columns for non-self-serve without PAYG support' , ( ) => {
123+ const newSubscription = SubscriptionFixture ( {
124+ organization,
125+ plan : 'am3_business' ,
126+ supportsOnDemand : false ,
127+ canSelfServe : false ,
128+ } ) ;
129+ SubscriptionStore . set ( organization . slug , newSubscription ) ;
130+ render (
131+ < UsageOverview
132+ subscription = { newSubscription }
133+ organization = { organization }
134+ usageData = { usageData }
135+ />
136+ ) ;
137+ expect ( screen . getAllByRole ( 'columnheader' ) ) . toHaveLength ( 4 ) ;
138+ expect (
139+ screen . queryByRole ( 'columnheader' , { name : 'Reserved spend' } )
140+ ) . not . toBeInTheDocument ( ) ;
141+ expect (
142+ screen . queryByRole ( 'columnheader' , { name : 'Pay-as-you-go spend' } )
143+ ) . not . toBeInTheDocument ( ) ;
144+ } ) ;
145+
96146 it ( 'renders table based on subscription state' , ( ) => {
97147 subscription . onDemandPeriodStart = '2025-05-02' ;
98148 subscription . onDemandPeriodEnd = '2025-06-01' ;
0 commit comments