mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-20 05:26:20 +00:00
Moved common test set-up code to helper function
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { Mock } from 'ts-mockery';
|
||||
import { ErrorHandler as createErrorHandler } from '../../src/common/ErrorHandler';
|
||||
import { renderWithEvents } from '../__mocks__/setUpTest';
|
||||
|
||||
const ComponentWithError = () => {
|
||||
throw new Error('Error!!');
|
||||
@@ -36,8 +36,7 @@ describe('<ErrorHandler />', () => {
|
||||
});
|
||||
|
||||
it('reloads page on button click', async () => {
|
||||
const user = userEvent.setup();
|
||||
render(<ErrorHandler children={<ComponentWithError />} />);
|
||||
const { user } = renderWithEvents(<ErrorHandler children={<ComponentWithError />} />);
|
||||
|
||||
expect(reload).not.toHaveBeenCalled();
|
||||
await user.click(screen.getByRole('button'));
|
||||
|
||||
Reference in New Issue
Block a user