2021-09-20 22:23:39 +03:00
|
|
|
import { shallow } from 'enzyme';
|
2022-02-14 22:04:38 +03:00
|
|
|
import { Route } from 'react-router-dom';
|
2021-09-20 22:23:39 +03:00
|
|
|
import createSettings from '../../src/settings/Settings';
|
2021-12-30 12:02:31 +03:00
|
|
|
import { NoMenuLayout } from '../../src/common/NoMenuLayout';
|
2022-02-14 22:04:38 +03:00
|
|
|
import { NavPillItem } from '../../src/utils/NavPills';
|
2021-09-20 22:23:39 +03:00
|
|
|
|
|
|
|
describe('<Settings />', () => {
|
|
|
|
const Component = () => null;
|
2021-12-24 16:15:28 +03:00
|
|
|
const Settings = createSettings(Component, Component, Component, Component, Component, Component);
|
2021-09-20 22:23:39 +03:00
|
|
|
|
2021-09-20 23:00:34 +03:00
|
|
|
it('renders a no-menu layout with the expected settings sections', () => {
|
2021-09-20 22:23:39 +03:00
|
|
|
const wrapper = shallow(<Settings />);
|
|
|
|
const layout = wrapper.find(NoMenuLayout);
|
2022-02-14 22:04:38 +03:00
|
|
|
const sections = wrapper.find(Route);
|
2021-09-20 22:23:39 +03:00
|
|
|
|
|
|
|
expect(layout).toHaveLength(1);
|
2022-02-14 22:04:38 +03:00
|
|
|
expect(sections).toHaveLength(4);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('renders expected menu', () => {
|
|
|
|
const wrapper = shallow(<Settings />);
|
|
|
|
const items = wrapper.find(NavPillItem);
|
|
|
|
|
|
|
|
expect(items).toHaveLength(3);
|
2022-02-14 22:28:28 +03:00
|
|
|
expect(items.first().prop('to')).toEqual('general');
|
2022-02-14 22:04:38 +03:00
|
|
|
expect(items.at(1).prop('to')).toEqual('short-urls');
|
2022-03-07 13:03:41 +03:00
|
|
|
expect(items.last().prop('to')).toEqual('other-items');
|
2021-09-20 22:23:39 +03:00
|
|
|
});
|
|
|
|
});
|