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,8 +1,8 @@
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { screen, waitFor } from '@testing-library/react';
|
||||
import { Router } from 'react-router-dom';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { MainHeader as createMainHeader } from '../../src/common/MainHeader';
|
||||
import { renderWithEvents } from '../__mocks__/setUpTest';
|
||||
|
||||
describe('<MainHeader />', () => {
|
||||
const MainHeader = createMainHeader(() => <>ServersDropdown</>);
|
||||
@@ -10,14 +10,11 @@ describe('<MainHeader />', () => {
|
||||
const history = createMemoryHistory();
|
||||
history.push(pathname);
|
||||
|
||||
const user = userEvent.setup();
|
||||
const renderResult = render(
|
||||
return renderWithEvents(
|
||||
<Router location={history.location} navigator={history}>
|
||||
<MainHeader />
|
||||
</Router>,
|
||||
);
|
||||
|
||||
return { user, ...renderResult };
|
||||
};
|
||||
|
||||
it('renders ServersDropdown', () => {
|
||||
|
||||
Reference in New Issue
Block a user