diff --git a/src/servers/ServersDropdown.js b/src/servers/ServersDropdown.js index cd345cc7..68ecf85e 100644 --- a/src/servers/ServersDropdown.js +++ b/src/servers/ServersDropdown.js @@ -34,7 +34,10 @@ export class ServersDropdown extends React.Component { ))} - + Export servers diff --git a/test/servers/ServersDropdown.test.js b/test/servers/ServersDropdown.test.js index dde12a82..6c8a90eb 100644 --- a/test/servers/ServersDropdown.test.js +++ b/test/servers/ServersDropdown.test.js @@ -13,11 +13,26 @@ describe('', () => { }); afterEach(() => wrapped.unmount()); - it('contains the list of servers', () => { - expect(wrapped.find(DropdownItem).length).toEqual(servers.length + 2); + it('contains the list of servers', () => + expect(wrapped.find(DropdownItem).filter('[to]')).toHaveLength(servers.length) + ); + + it('contains a toggle with proper title', () => + expect(wrapped.find(DropdownToggle)).toHaveLength(1) + ); + + it('contains a button to export servers', () => { + const items = wrapped.find(DropdownItem); + expect(items.filter('[divider]')).toHaveLength(1); + expect(items.filter('.servers-dropdown__export-item')).toHaveLength(1); }); - it('contains a toggle with proper title', () => { - expect(wrapped.find(DropdownToggle).length).toEqual(1); + it('contains a message when no servers exist yet', () => { + wrapped = shallow(); + const item = wrapped.find(DropdownItem); + + expect(item).toHaveLength(1); + expect(item.prop('disabled')).toEqual(true); + expect(item.find('i').text()).toEqual('Add a server first...'); }); });