diff --git a/src/utils/Storage.js b/src/utils/Storage.js index ae58110a..0b3efdaa 100644 --- a/src/utils/Storage.js +++ b/src/utils/Storage.js @@ -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); diff --git a/test/servers/ServersDropdown.test.js b/test/servers/ServersDropdown.test.js index 5374a1fa..3f8013f0 100644 --- a/test/servers/ServersDropdown.test.js +++ b/test/servers/ServersDropdown.test.js @@ -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('', () => { 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(); - }); - afterEach(() => { - wrapped.unmount(); + wrapped = shallow(); }); + afterEach(() => wrapped.unmount()); it('contains the list of servers', () => { expect(wrapped.find('DropdownItem').length).toEqual(servers.length);