2018-08-25 23:39:27 +02:00
|
|
|
import { shallow } from 'enzyme';
|
|
|
|
import React from 'react';
|
2018-12-17 22:32:51 +01:00
|
|
|
import asideMenuCreator from '../../src/common/AsideMenu';
|
2018-08-12 08:49:08 +02:00
|
|
|
|
|
|
|
describe('<AsideMenu />', () => {
|
|
|
|
let wrapped;
|
2018-12-17 22:32:51 +01:00
|
|
|
const DeleteServerButton = () => '';
|
2018-08-12 08:49:08 +02:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2018-12-17 22:32:51 +01:00
|
|
|
const AsideMenu = asideMenuCreator(DeleteServerButton);
|
|
|
|
|
2018-08-12 08:49:08 +02:00
|
|
|
wrapped = shallow(<AsideMenu selectedServer={{ id: 'abc123' }} />);
|
|
|
|
});
|
2018-10-28 21:26:47 +01:00
|
|
|
afterEach(() => wrapped.unmount());
|
2018-08-12 08:49:08 +02:00
|
|
|
|
2018-08-18 17:14:33 +02:00
|
|
|
it('contains links to different sections', () => {
|
2020-03-05 11:58:35 +01:00
|
|
|
const links = wrapped.find('[to]');
|
2018-08-12 08:49:08 +02:00
|
|
|
|
2019-04-19 12:54:56 +02:00
|
|
|
expect(links).toHaveLength(3);
|
2018-08-25 23:39:27 +02:00
|
|
|
links.forEach((link) => expect(link.prop('to')).toContain('abc123'));
|
2018-08-12 08:49:08 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
it('contains a button to delete server', () => {
|
2018-12-17 22:32:51 +01:00
|
|
|
expect(wrapped.find(DeleteServerButton)).toHaveLength(1);
|
2018-08-12 08:49:08 +02:00
|
|
|
});
|
|
|
|
});
|