Skip to content

Commit

Permalink
update test for LeftDrawerEventWrapper.tsx to 100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
timoph2 committed Nov 30, 2023
1 parent 655b6b3 commit 09b5363
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/LeftDrawerEvent/LeftDrawerEventWrapper.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ afterEach(() => {

describe('Testing Left Drawer Wrapper component for the Event Dashboard', () => {
test('Component should be rendered properly and the close menu button should function', async () => {
const { queryByText, queryByTestId } = render(
const { queryByText, getByTestId } = render(
<MockedProvider mocks={mocks}>
<BrowserRouter>
<I18nextProvider i18n={i18nForTest}>
Expand All @@ -86,9 +86,15 @@ describe('Testing Left Drawer Wrapper component for the Event Dashboard', () =>
</MockedProvider>
);

const pageContainer = getByTestId('mainpageright');
expect(pageContainer.className).toMatch(/pageContainer/i);
fireEvent.click(getByTestId('closeLeftDrawerBtn') as HTMLElement);
expect(pageContainer.className).toMatch(/expand/i);
fireEvent.click(getByTestId('closeLeftDrawerBtn') as HTMLElement);
expect(pageContainer.className).toMatch(/contract/i);

await waitFor(() =>
expect(queryByText('Event Management')).toBeInTheDocument()
);
fireEvent.click(queryByTestId('closeLeftDrawerBtn') as HTMLElement);
});
});

0 comments on commit 09b5363

Please sign in to comment.