
* Removed two enzyme test with testing-library tests * Got rid of enzyme and wrapper in List.spec.tsx * Got rid of enzyme and wrapper in ListItem.spec.tsx * Got rid of enzyme and wrapper in BytesFormatted.spec.tsx * Got rid of enzyme and wrapper in ConfirmationModal.spec.tsx * Got rid of enzyme and wrapper in Tabs.spec.tsx * Got rid of enzyme and wrapper in Actions.spec.tsx * Got rid of enzyme and wrapper in ListItem.spec.tsx * Got rid of enzyme and wrapper in FiltersContainer.spec.tsx * Got rid of enzyme and wrapper in ListItem.spec.tsx * Got rid of Enzyme in a two more files * Got rid of Enzyme in testHelpers.tsx * Got rid of snapshots * Three wrappers replaced with render from testHelpers * Testing id replaced * Fixed linter warnings * Got rid of testIds * Got rid of unnecessary containers and ...queryBy functions * Got rid of dublicated ...getByRole functions * Got rid of dublicated more than two times ...getByText functions * Got rid of unused imports * Got rid of unused import * Desciptions fixed * Got rid of providers * Got rid of unused imports * package-lock.json reverted * Refactor Actions component specs * Get rid of TestRouterWrapper * Refactor specs * Refactor specs * linting Co-authored-by: k.morozov <k.morozov@ffin.ru> Co-authored-by: lazzy-panda <grifx.design@gmail.com>
35 lines
1,014 B
TypeScript
35 lines
1,014 B
TypeScript
import React from 'react';
|
|
import PageControl, {
|
|
PageControlProps,
|
|
} from 'components/common/Pagination/PageControl';
|
|
import { screen } from '@testing-library/react';
|
|
import { render } from 'lib/testHelpers';
|
|
import theme from 'theme/theme';
|
|
|
|
const page = 138;
|
|
|
|
describe('PageControl', () => {
|
|
const setupComponent = (props: Partial<PageControlProps> = {}) =>
|
|
render(<PageControl url="/test" page={page} current {...props} />);
|
|
|
|
const getButton = () => screen.getByRole('button');
|
|
|
|
it('renders current page', () => {
|
|
setupComponent({ current: true });
|
|
expect(getButton()).toHaveStyle(
|
|
`background-color: ${theme.pagination.currentPage}`
|
|
);
|
|
});
|
|
|
|
it('renders non-current page', () => {
|
|
setupComponent({ current: false });
|
|
expect(getButton()).toHaveStyle(
|
|
`background-color: ${theme.pagination.backgroundColor}`
|
|
);
|
|
});
|
|
|
|
it('renders page number', () => {
|
|
setupComponent({ current: false });
|
|
expect(getButton()).toHaveTextContent(String(page));
|
|
});
|
|
});
|