2018-07-22 23:49:51 +03:00
|
|
|
import { identity } from 'ramda';
|
2018-06-14 20:42:42 +03:00
|
|
|
import React from 'react';
|
|
|
|
import { ServersDropdown } from '../../src/servers/ServersDropdown';
|
|
|
|
import { shallow } from 'enzyme';
|
2018-08-20 17:44:46 +03:00
|
|
|
import { DropdownItem, DropdownToggle } from 'reactstrap';
|
2018-06-14 20:42:42 +03:00
|
|
|
|
2018-07-22 23:49:51 +03:00
|
|
|
describe('<ServersDropdown />', () => {
|
2018-06-14 20:42:42 +03:00
|
|
|
let wrapped;
|
2018-07-22 23:49:51 +03:00
|
|
|
const servers = [{ name: 'foo', id: 1 }, { name: 'bar', id: 2 }, { name: 'baz', id: 3 }];
|
2018-06-14 20:42:42 +03:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2018-07-22 23:49:51 +03:00
|
|
|
wrapped = shallow(<ServersDropdown servers={servers} listServers={identity} />);
|
2018-06-14 20:42:42 +03:00
|
|
|
});
|
2018-07-22 23:49:51 +03:00
|
|
|
afterEach(() => wrapped.unmount());
|
2018-06-14 20:42:42 +03:00
|
|
|
|
|
|
|
it('contains the list of servers', () => {
|
2018-08-20 17:44:46 +03:00
|
|
|
expect(wrapped.find(DropdownItem).length).toEqual(servers.length + 2);
|
2018-06-14 20:42:42 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('contains a toggle with proper title', () => {
|
2018-08-20 17:44:46 +03:00
|
|
|
expect(wrapped.find(DropdownToggle).length).toEqual(1);
|
2018-06-14 20:42:42 +03:00
|
|
|
});
|
|
|
|
});
|