Moved common test set-up code to helper function

This commit is contained in:
Alejandro Celaya
2022-07-09 23:03:21 +02:00
parent cb13e82b9c
commit d07f7e757e
57 changed files with 376 additions and 476 deletions

View File

@@ -1,13 +1,9 @@
import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { CopyToClipboardIcon } from '../../src/utils/CopyToClipboardIcon';
import { renderWithEvents } from '../__mocks__/setUpTest';
describe('<CopyToClipboardIcon />', () => {
const onCopy = jest.fn();
const setUp = (text = 'foo') => ({
user: userEvent.setup(),
...render(<CopyToClipboardIcon text={text} onCopy={onCopy} />),
});
const setUp = (text = 'foo') => renderWithEvents(<CopyToClipboardIcon text={text} onCopy={onCopy} />);
afterEach(jest.clearAllMocks);