shlink-web-client/test/common/AsideMenu.test.js

27 lines
688 B
JavaScript
Raw Normal View History

2018-08-12 09:49:08 +03:00
import { shallow } from 'enzyme'
import React from 'react'
import AsideMenu from '../../src/common/AsideMenu'
import { NavLink } from 'react-router-dom';
2018-08-12 09:49:08 +03:00
describe('<AsideMenu />', () => {
let wrapped;
beforeEach(() => {
wrapped = shallow(<AsideMenu selectedServer={{ id: 'abc123' }} />);
});
afterEach(() => {
wrapped.unmount();
});
it('contains links to different sections', () => {
const links = wrapped.find(NavLink);
2018-08-12 09:49:08 +03:00
expect(links).toHaveLength(3);
2018-08-12 09:49:08 +03:00
links.forEach(link => expect(link.prop('to')).toContain('abc123'));
});
it('contains a button to delete server', () => {
expect(wrapped.find('DeleteServerButton')).toHaveLength(1);
});
});