mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-11 18:13:47 +00:00
Remove sidebar reducer, which couple web-client with web-component
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
import { render } from '@testing-library/react';
|
||||
import { fromPartial } from '@total-typescript/shoehorn';
|
||||
import type { Sidebar } from '../../src/common/reducers/sidebar';
|
||||
import { createMemoryHistory } from 'history';
|
||||
import { Router } from 'react-router-dom';
|
||||
import { ShlinkVersionsContainer } from '../../src/common/ShlinkVersionsContainer';
|
||||
|
||||
describe('<ShlinkVersionsContainer />', () => {
|
||||
const setUp = (sidebar: Sidebar) => render(
|
||||
<ShlinkVersionsContainer selectedServer={fromPartial({})} sidebar={sidebar} />,
|
||||
);
|
||||
const setUp = (activeRoute: string) => {
|
||||
const history = createMemoryHistory();
|
||||
history.push(activeRoute);
|
||||
|
||||
return render(
|
||||
<Router location={history.location} navigator={history}>
|
||||
<ShlinkVersionsContainer selectedServer={fromPartial({})} />
|
||||
</Router>,
|
||||
);
|
||||
};
|
||||
|
||||
it.each([
|
||||
[{ sidebarPresent: false }, 'text-center'],
|
||||
[{ sidebarPresent: true }, 'text-center shlink-versions-container--with-sidebar'],
|
||||
['/something', 'text-center'],
|
||||
['/server/foo/edit', 'text-center'],
|
||||
['/server/foo/bar', 'text-center shlink-versions-container--with-sidebar'],
|
||||
])('renders proper col classes based on sidebar status', (sidebar, expectedClasses) => {
|
||||
const { container } = setUp(sidebar);
|
||||
expect(container.firstChild).toHaveAttribute('class', `${expectedClasses}`);
|
||||
|
||||
Reference in New Issue
Block a user