shlink-web-client/test/settings/Settings.test.tsx

30 lines
1 KiB
TypeScript
Raw Normal View History

import { shallow } from 'enzyme';
2022-02-14 22:04:38 +03:00
import { Route } from 'react-router-dom';
import createSettings from '../../src/settings/Settings';
import { NoMenuLayout } from '../../src/common/NoMenuLayout';
2022-02-14 22:04:38 +03:00
import { NavPillItem } from '../../src/utils/NavPills';
describe('<Settings />', () => {
const Component = () => null;
const Settings = createSettings(Component, Component, Component, Component, Component, Component);
it('renders a no-menu layout with the expected settings sections', () => {
const wrapper = shallow(<Settings />);
const layout = wrapper.find(NoMenuLayout);
2022-02-14 22:04:38 +03:00
const sections = wrapper.find(Route);
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-02-14 22:28:28 +03:00
expect(items.last().prop('to')).toEqual('secondary-items');
});
});