mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-20 21:46:20 +00:00
Moved common test set-up code to helper function
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { screen } from '@testing-library/react';
|
||||
import { values } from 'ramda';
|
||||
import { OrderingDropdown, OrderingDropdownProps } from '../../src/utils/OrderingDropdown';
|
||||
import { OrderDir } from '../../src/utils/helpers/ordering';
|
||||
import { renderWithEvents } from '../__mocks__/setUpTest';
|
||||
|
||||
describe('<OrderingDropdown />', () => {
|
||||
const items = {
|
||||
@@ -10,10 +10,9 @@ describe('<OrderingDropdown />', () => {
|
||||
bar: 'Bar',
|
||||
baz: 'Hello World',
|
||||
};
|
||||
const setUp = (props: Partial<OrderingDropdownProps> = {}) => ({
|
||||
user: userEvent.setup(),
|
||||
...render(<OrderingDropdown items={items} order={{}} onChange={jest.fn()} {...props} />),
|
||||
});
|
||||
const setUp = (props: Partial<OrderingDropdownProps> = {}) => renderWithEvents(
|
||||
<OrderingDropdown items={items} order={{}} onChange={jest.fn()} {...props} />,
|
||||
);
|
||||
const setUpWithDisplayedMenu = async (props: Partial<OrderingDropdownProps> = {}) => {
|
||||
const result = setUp(props);
|
||||
const { user } = result;
|
||||
|
||||
Reference in New Issue
Block a user