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-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', () => {
|
|
|
|
expect(wrapped.find('DropdownItem').length).toEqual(servers.length);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('contains a toggle with proper title', () => {
|
|
|
|
expect(wrapped.find('DropdownToggle').length).toEqual(1);
|
|
|
|
});
|
|
|
|
});
|