From 0e1db6e14455a85b303cbcdf3952d865d79a0940 Mon Sep 17 00:00:00 2001 From: Calvin Yau Date: Wed, 15 Oct 2025 14:11:52 -0700 Subject: [PATCH] feat: Always show plan cancelled confirmation --- .../CurrentOrgPlan/CurrentOrgPlan.test.tsx | 34 +++++++++++++++++-- .../CurrentOrgPlan/CurrentOrgPlan.tsx | 3 +- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx index 3885cbec88..b4369b2f46 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx @@ -236,7 +236,7 @@ describe('CurrentOrgPlan', () => { }) describe('when info message cancellation should be shown', () => { - it('renders when subscription detail data is available', async () => { + it('renders when subscription has just been canceled', async () => { setup({ accountDetails: { subscriptionDetail: { @@ -246,11 +246,39 @@ describe('CurrentOrgPlan', () => { } as z.infer, }) + // isCancellation is true to simulate the subscription has just been canceled render(, { wrapper: cancellationPlanWrapper }) - const pendingCancellation = await screen.findByText( + const cancellationConfirmation = await screen.findByText( + /Cancellation confirmation/ + ) + const cancellationTime = await screen.findByText( + /on August 2nd 2024, 8:52 p.m./ + ) + expect(cancellationConfirmation).toBeInTheDocument() + expect(cancellationTime).toBeInTheDocument() + }) + + it('renders when cancelAtPeriodEnd is true without having just been canceled', async () => { + setup({ + accountDetails: { + subscriptionDetail: { + cancelAtPeriodEnd: true, + currentPeriodEnd: 1722631954, + }, + } as z.infer, + }) + + // isCancellation is false to simulate the subscription was previously canceled + render(, { wrapper: noUpdatedPlanWrapper }) + const cancellationConfirmation = await screen.findByText( + /Cancellation confirmation/ + ) + expect(cancellationConfirmation).toBeInTheDocument() + const cancellationTime = await screen.findByText( /on August 2nd 2024, 8:52 p.m./ ) - expect(pendingCancellation).toBeInTheDocument() + expect(cancellationConfirmation).toBeInTheDocument() + expect(cancellationTime).toBeInTheDocument() }) }) diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.tsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.tsx index 95a673f7d1..e76dfb186a 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.tsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.tsx @@ -70,7 +70,8 @@ function CurrentOrgPlan() { return (
- {planUpdatedNotification.isCancellation ? ( + {planUpdatedNotification.isCancellation || + accountDetails?.subscriptionDetail?.cancelAtPeriodEnd ? (