2020-08-29 10:19:15 +03:00
|
|
|
import { shallow, ShallowWrapper } from 'enzyme';
|
|
|
|
import { Mock } from 'ts-mockery';
|
2018-12-18 00:32:51 +03:00
|
|
|
import asideMenuCreator from '../../src/common/AsideMenu';
|
2020-08-29 10:19:15 +03:00
|
|
|
import { ServerWithId } from '../../src/servers/data';
|
2018-08-12 09:49:08 +03:00
|
|
|
|
|
|
|
describe('<AsideMenu />', () => {
|
2020-08-29 10:19:15 +03:00
|
|
|
let wrapped: ShallowWrapper;
|
|
|
|
const DeleteServerButton = () => null;
|
2018-08-12 09:49:08 +03:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2018-12-18 00:32:51 +03:00
|
|
|
const AsideMenu = asideMenuCreator(DeleteServerButton);
|
|
|
|
|
2020-08-29 10:19:15 +03:00
|
|
|
wrapped = shallow(<AsideMenu selectedServer={Mock.of<ServerWithId>({ id: 'abc123' })} />);
|
2018-08-12 09:49:08 +03:00
|
|
|
});
|
2018-10-28 23:26:47 +03:00
|
|
|
afterEach(() => wrapped.unmount());
|
2018-08-12 09:49:08 +03:00
|
|
|
|
2018-08-18 18:14:33 +03:00
|
|
|
it('contains links to different sections', () => {
|
2020-03-05 13:58:35 +03:00
|
|
|
const links = wrapped.find('[to]');
|
2018-08-12 09:49:08 +03:00
|
|
|
|
2020-12-06 20:32:24 +03:00
|
|
|
expect(links).toHaveLength(5);
|
2018-08-26 00:39:27 +03:00
|
|
|
links.forEach((link) => expect(link.prop('to')).toContain('abc123'));
|
2018-08-12 09:49:08 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('contains a button to delete server', () => {
|
2018-12-18 00:32:51 +03:00
|
|
|
expect(wrapped.find(DeleteServerButton)).toHaveLength(1);
|
2018-08-12 09:49:08 +03:00
|
|
|
});
|
|
|
|
});
|