mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-14 19:43:49 +00:00
Moved common test set-up code to helper function
This commit is contained in:
@@ -1,18 +1,15 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { screen } from '@testing-library/react';
|
||||
import { Mock } from 'ts-mockery';
|
||||
import { DuplicatedServersModal } from '../../../src/servers/helpers/DuplicatedServersModal';
|
||||
import { ServerData } from '../../../src/servers/data';
|
||||
import { renderWithEvents } from '../../__mocks__/setUpTest';
|
||||
|
||||
describe('<DuplicatedServersModal />', () => {
|
||||
const onDiscard = jest.fn();
|
||||
const onSave = jest.fn();
|
||||
const setUp = (duplicatedServers: ServerData[] = []) => ({
|
||||
user: userEvent.setup(),
|
||||
...render(
|
||||
<DuplicatedServersModal isOpen duplicatedServers={duplicatedServers} onDiscard={onDiscard} onSave={onSave} />,
|
||||
),
|
||||
});
|
||||
const setUp = (duplicatedServers: ServerData[] = []) => renderWithEvents(
|
||||
<DuplicatedServersModal isOpen duplicatedServers={duplicatedServers} onDiscard={onDiscard} onSave={onSave} />,
|
||||
);
|
||||
|
||||
beforeEach(jest.clearAllMocks);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user