2022-05-06 22:01:44 +03:00
|
|
|
import { render } from '@testing-library/react';
|
2020-12-14 21:05:25 +03:00
|
|
|
import { Mock } from 'ts-mockery';
|
2023-02-18 13:11:01 +03:00
|
|
|
import type { Sidebar } from '../../src/common/reducers/sidebar';
|
2022-05-28 11:47:39 +03:00
|
|
|
import { ShlinkVersionsContainer } from '../../src/common/ShlinkVersionsContainer';
|
2023-02-18 12:40:37 +03:00
|
|
|
import type { SelectedServer } from '../../src/servers/data';
|
2020-12-14 21:05:25 +03:00
|
|
|
|
|
|
|
describe('<ShlinkVersionsContainer />', () => {
|
2022-05-06 22:01:44 +03:00
|
|
|
const setUp = (sidebar: Sidebar) => render(
|
|
|
|
<ShlinkVersionsContainer selectedServer={Mock.all<SelectedServer>()} sidebar={sidebar} />,
|
|
|
|
);
|
2020-12-14 21:05:25 +03:00
|
|
|
|
2021-09-20 23:00:34 +03:00
|
|
|
it.each([
|
2022-03-26 14:17:42 +03:00
|
|
|
[{ sidebarPresent: false }, 'text-center'],
|
|
|
|
[{ sidebarPresent: true }, 'text-center shlink-versions-container--with-sidebar'],
|
2022-03-11 18:03:15 +03:00
|
|
|
])('renders proper col classes based on sidebar status', (sidebar, expectedClasses) => {
|
2022-05-06 22:01:44 +03:00
|
|
|
const { container } = setUp(sidebar);
|
|
|
|
expect(container.firstChild).toHaveAttribute('class', `${expectedClasses}`);
|
2020-12-14 21:05:25 +03:00
|
|
|
});
|
|
|
|
});
|