Fixed tests

This commit is contained in:
Alejandro Celaya 2018-07-22 22:49:51 +02:00
parent 86a1cdf4d1
commit 3eaa66435a
2 changed files with 7 additions and 7 deletions

View file

@ -14,4 +14,5 @@ export class Storage {
set = (key, value) => this.localStorage.setItem(buildPath(key), JSON.stringify(value));
}
export default new Storage(localStorage);
const storage = typeof localStorage !== 'undefined' ? localStorage : {};
export default new Storage(storage);

View file

@ -1,17 +1,16 @@
import { identity } from 'ramda';
import React from 'react';
import { ServersDropdown } from '../../src/servers/ServersDropdown';
import { shallow } from 'enzyme';
describe('ServersDropdown', () => {
describe('<ServersDropdown />', () => {
let wrapped;
const servers = [{ name: 'foo' }, { name: 'bar' }, { name: 'baz' }];
const servers = [{ name: 'foo', id: 1 }, { name: 'bar', id: 2 }, { name: 'baz', id: 3 }];
beforeEach(() => {
wrapped = shallow(<ServersDropdown servers={servers} />);
});
afterEach(() => {
wrapped.unmount();
wrapped = shallow(<ServersDropdown servers={servers} listServers={identity} />);
});
afterEach(() => wrapped.unmount());
it('contains the list of servers', () => {
expect(wrapped.find('DropdownItem').length).toEqual(servers.length);