2020-12-14 21:05:25 +03:00
|
|
|
import { shallow, ShallowWrapper } from 'enzyme';
|
|
|
|
import { Mock } from 'ts-mockery';
|
|
|
|
import ShlinkVersionsContainer from '../../src/common/ShlinkVersionsContainer';
|
2022-03-11 18:03:15 +03:00
|
|
|
import { SelectedServer } from '../../src/servers/data';
|
|
|
|
import { Sidebar } from '../../src/common/reducers/sidebar';
|
2020-12-14 21:05:25 +03:00
|
|
|
|
|
|
|
describe('<ShlinkVersionsContainer />', () => {
|
|
|
|
let wrapper: ShallowWrapper;
|
|
|
|
|
2022-03-11 18:03:15 +03:00
|
|
|
const createWrapper = (sidebar: Sidebar) => {
|
|
|
|
wrapper = shallow(<ShlinkVersionsContainer selectedServer={Mock.all<SelectedServer>()} sidebar={sidebar} />);
|
2020-12-14 21:05:25 +03:00
|
|
|
|
|
|
|
return wrapper;
|
|
|
|
};
|
|
|
|
|
|
|
|
afterEach(() => wrapper?.unmount());
|
|
|
|
|
2021-09-20 23:00:34 +03:00
|
|
|
it.each([
|
2022-03-11 18:12:54 +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) => {
|
|
|
|
const wrapper = createWrapper(sidebar);
|
2020-12-14 21:05:25 +03:00
|
|
|
|
2020-12-15 19:57:24 +03:00
|
|
|
expect(wrapper.find('div').prop('className')).toEqual(`${expectedClasses}`);
|
2020-12-14 21:05:25 +03:00
|
|
|
});
|
|
|
|
});
|