Skip to content

Commit

Permalink
fixup! Add TestRouter to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
canac committed Nov 19, 2024
1 parent 2493280 commit 27ced8b
Showing 1 changed file with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@ describe('ExpectedMonthlyTotalReportTable', () => {
it('renders empty', async () => {
const empty: ExpectedDonationRowFragment[] = [];
const { queryByRole } = render(
<ThemeProvider theme={theme}>
<ExpectedMonthlyTotalReportTable
accountListId={'abc'}
title={'Donations So Far This Month'}
data={empty}
donations={true}
total={0}
currency={'USD'}
/>
</ThemeProvider>,
<TestRouter>
<ThemeProvider theme={theme}>
<ExpectedMonthlyTotalReportTable
accountListId={'abc'}
title={'Donations So Far This Month'}
data={empty}
donations={true}
total={0}
currency={'USD'}
/>
</ThemeProvider>
</TestRouter>,
);

expect(queryByRole('button')).not.toBeInTheDocument();
Expand All @@ -52,16 +54,18 @@ describe('ExpectedMonthlyTotalReportTable', () => {
});

const { queryAllByRole, getAllByTestId, getByText, getByTestId } = render(
<ThemeProvider theme={theme}>
<ExpectedMonthlyTotalReportTable
accountListId={'abc'}
title={'Donations So Far This Month'}
data={[donation1, donation2]}
donations={true}
total={0}
currency={'USD'}
/>
</ThemeProvider>,
<TestRouter>
<ThemeProvider theme={theme}>
<ExpectedMonthlyTotalReportTable
accountListId={'abc'}
title={'Donations So Far This Month'}
data={[donation1, donation2]}
donations={true}
total={0}
currency={'USD'}
/>
</ThemeProvider>
</TestRouter>,
);

expect(queryAllByRole('button')[0]).toBeInTheDocument();
Expand Down

0 comments on commit 27ced8b

Please sign in to comment.