2022-05-06 22:01:44 +03:00
|
|
|
import { render } from '@testing-library/react';
|
2023-04-13 22:48:29 +03:00
|
|
|
import { fromPartial } from '@total-typescript/shoehorn';
|
2023-08-06 19:07:03 +03:00
|
|
|
import { createMemoryHistory } from 'history';
|
|
|
|
import { Router } from 'react-router-dom';
|
2022-05-28 11:47:39 +03:00
|
|
|
import { ShlinkVersionsContainer } from '../../src/common/ShlinkVersionsContainer';
|
2020-12-14 21:05:25 +03:00
|
|
|
|
|
|
|
describe('<ShlinkVersionsContainer />', () => {
|
2023-08-06 19:07:03 +03:00
|
|
|
const setUp = (activeRoute: string) => {
|
|
|
|
const history = createMemoryHistory();
|
|
|
|
history.push(activeRoute);
|
|
|
|
|
|
|
|
return render(
|
|
|
|
<Router location={history.location} navigator={history}>
|
|
|
|
<ShlinkVersionsContainer selectedServer={fromPartial({})} />
|
|
|
|
</Router>,
|
|
|
|
);
|
|
|
|
};
|
2020-12-14 21:05:25 +03:00
|
|
|
|
2021-09-20 23:00:34 +03:00
|
|
|
it.each([
|
2023-08-06 19:07:03 +03:00
|
|
|
['/something', 'text-center'],
|
|
|
|
['/server/foo/edit', 'text-center'],
|
|
|
|
['/server/foo/bar', '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
|
|
|
});
|
|
|
|
});
|