@@ -236,7 +236,7 @@ describe('CurrentOrgPlan', () => {
236236 } )
237237
238238 describe ( 'when info message cancellation should be shown' , ( ) => {
239- it ( 'renders when subscription detail data is available ' , async ( ) => {
239+ it ( 'renders when subscription has just been canceled ' , async ( ) => {
240240 setup ( {
241241 accountDetails : {
242242 subscriptionDetail : {
@@ -246,11 +246,39 @@ describe('CurrentOrgPlan', () => {
246246 } as z . infer < typeof AccountDetailsSchema > ,
247247 } )
248248
249+ // isCancellation is true to simulate the subscription has just been canceled
249250 render ( < CurrentOrgPlan /> , { wrapper : cancellationPlanWrapper } )
250- const pendingCancellation = await screen . findByText (
251+ const cancellationConfirmation = await screen . findByText (
252+ / C a n c e l l a t i o n c o n f i r m a t i o n /
253+ )
254+ const cancellationTime = await screen . findByText (
255+ / o n A u g u s t 2 n d 2 0 2 4 , 8 : 5 2 p .m ./
256+ )
257+ expect ( cancellationConfirmation ) . toBeInTheDocument ( )
258+ expect ( cancellationTime ) . toBeInTheDocument ( )
259+ } )
260+
261+ it ( 'renders when cancelAtPeriodEnd is true without having just been canceled' , async ( ) => {
262+ setup ( {
263+ accountDetails : {
264+ subscriptionDetail : {
265+ cancelAtPeriodEnd : true ,
266+ currentPeriodEnd : 1722631954 ,
267+ } ,
268+ } as z . infer < typeof AccountDetailsSchema > ,
269+ } )
270+
271+ // isCancellation is false to simulate the subscription was previously canceled
272+ render ( < CurrentOrgPlan /> , { wrapper : noUpdatedPlanWrapper } )
273+ const cancellationConfirmation = await screen . findByText (
274+ / C a n c e l l a t i o n c o n f i r m a t i o n /
275+ )
276+ expect ( cancellationConfirmation ) . toBeInTheDocument ( )
277+ const cancellationTime = await screen . findByText (
251278 / o n A u g u s t 2 n d 2 0 2 4 , 8 : 5 2 p .m ./
252279 )
253- expect ( pendingCancellation ) . toBeInTheDocument ( )
280+ expect ( cancellationConfirmation ) . toBeInTheDocument ( )
281+ expect ( cancellationTime ) . toBeInTheDocument ( )
254282 } )
255283 } )
256284
0 commit comments