Skip to content

Commit

Permalink
fix: Fix cancel test
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin-codecov committed Oct 22, 2024
1 parent d6a778c commit 2f21752
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,19 @@ const mockEnterpriseAccountDetailsHundredPercent = {
}

const alertOptionWrapperCreator = (
alertOptionString: AlertOptionsType | ''
alertOptionString: AlertOptionsType | '',
isCancellation?: boolean
) => {
const wrapper: React.FC<React.PropsWithChildren> = ({ children }) => (
<MemoryRouter initialEntries={['/billing/gh/codecov']}>
<Route path="/billing/:provider/:owner">
<QueryClientProvider client={queryClient}>
<PlanUpdatedPlanNotificationContext.Provider
value={{
updatedNotification: { alertOption: alertOptionString },
updatedNotification: {
alertOption: alertOptionString,
isCancellation,
},
setUpdatedNotification: noop,
}}
>
Expand All @@ -105,6 +109,7 @@ const alertOptionWrapperCreator = (
const server = setupServer()
const wrapper = alertOptionWrapperCreator(AlertOptions.SUCCESS)
const noUpdatedPlanWrapper = alertOptionWrapperCreator('')
const cancellationPlanWrapper = alertOptionWrapperCreator('', true)

beforeAll(() => server.listen())
afterEach(() => {
Expand Down Expand Up @@ -228,7 +233,7 @@ describe('CurrentOrgPlan', () => {
})

describe('when info message cancellation should be shown', () => {
it('renders when subscription detail data is available', async () => {
it.only('renders when subscription detail data is available', async () => {
setup({
accountDetails: {
plan: {
Expand All @@ -245,7 +250,7 @@ describe('CurrentOrgPlan', () => {
} as z.infer<typeof AccountDetailsSchema>,
})

render(<CurrentOrgPlan />, { wrapper: noUpdatedPlanWrapper })
render(<CurrentOrgPlan />, { wrapper: cancellationPlanWrapper })
const pendingCancellation = await screen.findByText(
/on August 2nd 2024, 8:52 p.m./
)
Expand Down

0 comments on commit 2f21752

Please sign in to comment.