@@ -121,11 +121,15 @@ describe('PrimaryNavigationQuotaExceeded', function () {
121121 // doesn't show categories with <=1 reserved tier and no PAYG
122122 expect (
123123 screen . getByText (
124- / Y o u ’ v e r u n o u t o f e r r o r s , r e p l a y s , s p a n s , a n d c o n t i n u o u s p r o f i l e h o u r s f o r t h i s b i l l i n g c y c l e ./
124+ / Y o u h a v e u s e d u p y o u r q u o t a f o r e r r o r s , r e p l a y s , s p a n s , a n d c o n t i n u o u s p r o f i l e h o u r s . M o n i t o r i n g a n d n e w d a t a f o r t h e s e f e a t u r e s a r e p a u s e d u n t i l y o u r q u o t a r e s e t s ./
125125 )
126126 ) . toBeInTheDocument ( ) ;
127127 expect ( screen . queryByText ( / c r o n m o n i t o r s / ) ) . not . toBeInTheDocument ( ) ;
128- expect ( screen . getByRole ( 'checkbox' ) ) . not . toBeChecked ( ) ;
128+ expect (
129+ screen . getByRole ( 'button' , {
130+ name : 'Dismiss alert for the rest of the billing cycle' ,
131+ } )
132+ ) . toBeInTheDocument ( ) ;
129133 } ) ;
130134
131135 it ( 'should render for single category' , async function ( ) {
@@ -147,9 +151,15 @@ describe('PrimaryNavigationQuotaExceeded', function () {
147151
148152 expect ( await screen . findByText ( 'Error Quota Exceeded' ) ) . toBeInTheDocument ( ) ;
149153 expect (
150- screen . getByText ( / Y o u ’ v e r u n o u t o f e r r o r s f o r t h i s b i l l i n g c y c l e ./ )
154+ screen . getByText (
155+ / Y o u h a v e u s e d u p y o u r q u o t a f o r e r r o r s . M o n i t o r i n g a n d n e w d a t a a r e p a u s e d u n t i l y o u r q u o t a r e s e t s ./
156+ )
151157 ) . toBeInTheDocument ( ) ; // doesn't show categories with <=1 reserved tier and no PAYG
152- expect ( screen . getByRole ( 'checkbox' ) ) . not . toBeChecked ( ) ;
158+ expect (
159+ screen . getByRole ( 'button' , {
160+ name : 'Dismiss alert for the rest of the billing cycle' ,
161+ } )
162+ ) . toBeInTheDocument ( ) ;
153163 } ) ;
154164
155165 it ( 'should not render for zero categories' , function ( ) {
@@ -183,10 +193,17 @@ describe('PrimaryNavigationQuotaExceeded', function () {
183193 expect ( await screen . findByText ( 'Quotas Exceeded' ) ) . toBeInTheDocument ( ) ;
184194 expect (
185195 screen . getByText (
186- / Y o u ’ v e r u n o u t o f e r r o r s , r e p l a y s , s p a n s , c r o n m o n i t o r s , a n d c o n t i n u o u s p r o f i l e h o u r s f o r t h i s b i l l i n g c y c l e ./
196+ / Y o u h a v e u s e d u p y o u r q u o t a f o r e r r o r s , r e p l a y s , s p a n s , a n d c o n t i n u o u s p r o f i l e h o u r s ./
187197 )
188198 ) . toBeInTheDocument ( ) ;
189- expect ( screen . getByRole ( 'checkbox' ) ) . not . toBeChecked ( ) ;
199+ expect (
200+ screen . getByText ( / Y o u h a v e a l s o r e a c h e d y o u r q u o t a f o r c r o n m o n i t o r s ./ )
201+ ) . toBeInTheDocument ( ) ;
202+ expect (
203+ screen . getByRole ( 'button' , {
204+ name : 'Dismiss alert for the rest of the billing cycle' ,
205+ } )
206+ ) . toBeInTheDocument ( ) ;
190207
191208 // reset
192209 subscription . onDemandMaxSpend = 0 ;
@@ -213,10 +230,17 @@ describe('PrimaryNavigationQuotaExceeded', function () {
213230 expect ( await screen . findByText ( 'Quotas Exceeded' ) ) . toBeInTheDocument ( ) ;
214231 expect (
215232 screen . getByText (
216- / Y o u ’ v e r u n o u t o f e r r o r s , r e p l a y s , s p a n s , c r o n m o n i t o r s , a n d c o n t i n u o u s p r o f i l e h o u r s f o r t h i s b i l l i n g c y c l e ./
233+ / Y o u h a v e u s e d u p y o u r q u o t a f o r e r r o r s , r e p l a y s , s p a n s , a n d c o n t i n u o u s p r o f i l e h o u r s ./
217234 )
218235 ) . toBeInTheDocument ( ) ;
219- expect ( screen . getByRole ( 'checkbox' ) ) . not . toBeChecked ( ) ;
236+ expect (
237+ screen . getByText ( / Y o u h a v e a l s o r e a c h e d y o u r q u o t a f o r c r o n m o n i t o r s ./ )
238+ ) . toBeInTheDocument ( ) ;
239+ expect (
240+ screen . getByRole ( 'button' , {
241+ name : 'Dismiss alert for the rest of the billing cycle' ,
242+ } )
243+ ) . toBeInTheDocument ( ) ;
220244
221245 // reset
222246 subscription . onDemandMaxSpend = 0 ;
@@ -236,15 +260,19 @@ describe('PrimaryNavigationQuotaExceeded', function () {
236260 subscription . canSelfServe = true ;
237261 } ) ;
238262
239- it ( 'should update prompts when checkbox is toggled ' , async function ( ) {
263+ it ( 'should update prompts when dismissed ' , async function ( ) {
240264 render ( < PrimaryNavigationQuotaExceeded organization = { organization } /> ) ;
241265
242266 // open the alert
243267 await userEvent . click ( await screen . findByRole ( 'button' , { name : 'Billing Status' } ) ) ;
244268 expect ( await screen . findByText ( 'Quotas Exceeded' ) ) . toBeInTheDocument ( ) ;
245269
246270 // stop the alert from animating
247- await userEvent . click ( screen . getByRole ( 'checkbox' ) ) ;
271+ await userEvent . click (
272+ screen . getByRole ( 'button' , {
273+ name : 'Dismiss alert for the rest of the billing cycle' ,
274+ } )
275+ ) ;
248276 expect ( promptMock ) . toHaveBeenCalledTimes ( 4 ) ; // one for each category
249277 } ) ;
250278
0 commit comments