diff --git a/test/common/AsideMenu.test.js b/test/common/AsideMenu.test.js
index f2241ee4..75500821 100644
--- a/test/common/AsideMenu.test.js
+++ b/test/common/AsideMenu.test.js
@@ -1,12 +1,15 @@
import { shallow } from 'enzyme';
import React from 'react';
import { NavLink } from 'react-router-dom';
-import AsideMenu from '../../src/common/AsideMenu';
+import asideMenuCreator from '../../src/common/AsideMenu';
describe('', () => {
let wrapped;
+ const DeleteServerButton = () => '';
beforeEach(() => {
+ const AsideMenu = asideMenuCreator(DeleteServerButton);
+
wrapped = shallow();
});
afterEach(() => wrapped.unmount());
@@ -20,6 +23,6 @@ describe('', () => {
});
it('contains a button to delete server', () => {
- expect(wrapped.find('DeleteServerButton')).toHaveLength(1);
+ expect(wrapped.find(DeleteServerButton)).toHaveLength(1);
});
});
diff --git a/test/servers/CreateServer.test.js b/test/servers/CreateServer.test.js
index c9ce859f..ed6aff67 100644
--- a/test/servers/CreateServer.test.js
+++ b/test/servers/CreateServer.test.js
@@ -2,11 +2,11 @@ import React from 'react';
import { shallow } from 'enzyme';
import { identity } from 'ramda';
import sinon from 'sinon';
-import CreateServer from '../../src/servers/CreateServer';
-import ImportServersBtn from '../../src/servers/helpers/ImportServersBtn';
+import createServerConstruct from '../../src/servers/CreateServer';
describe('', () => {
let wrapper;
+ const ImportServersBtn = () => '';
const createServerMock = sinon.fake();
const historyMock = {
push: sinon.fake(),
@@ -16,6 +16,8 @@ describe('', () => {
createServerMock.resetHistory();
historyMock.push.resetHistory();
+ const CreateServer = createServerConstruct(ImportServersBtn);
+
wrapper = shallow(
);
diff --git a/test/servers/DeleteServerButton.test.js b/test/servers/DeleteServerButton.test.js
index 9da480a8..fbe11b09 100644
--- a/test/servers/DeleteServerButton.test.js
+++ b/test/servers/DeleteServerButton.test.js
@@ -1,12 +1,14 @@
import React from 'react';
import { shallow } from 'enzyme';
-import DeleteServerButton from '../../src/servers/DeleteServerButton';
+import deleteServerButtonConstruct from '../../src/servers/DeleteServerButton';
import DeleteServerModal from '../../src/servers/DeleteServerModal';
describe('', () => {
let wrapper;
beforeEach(() => {
+ const DeleteServerButton = deleteServerButtonConstruct(DeleteServerModal);
+
wrapper = shallow();
});
afterEach(() => wrapper.unmount());
diff --git a/test/servers/DeleteServerModal.test.js b/test/servers/DeleteServerModal.test.js
index c5b879c2..ab06004d 100644
--- a/test/servers/DeleteServerModal.test.js
+++ b/test/servers/DeleteServerModal.test.js
@@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
import { Modal, ModalBody, ModalFooter, ModalHeader } from 'reactstrap';
-import { DeleteServerModalComponent } from '../../src/servers/DeleteServerModal';
+import DeleteServerModal from '../../src/servers/DeleteServerModal';
describe('', () => {
let wrapper;
@@ -17,7 +17,7 @@ describe('', () => {
historyMock.push.resetHistory();
wrapper = shallow(
- ', () => {
let wrapped;
+ let ServersDropdown;
const servers = {
'1a': { name: 'foo', id: 1 },
'2b': { name: 'bar', id: 2 },
@@ -13,6 +14,7 @@ describe('', () => {
};
beforeEach(() => {
+ ServersDropdown = serversDropdownCreator({});
wrapped = shallow();
});
afterEach(() => wrapped.unmount());
diff --git a/test/servers/helpers/ImportServersBtn.test.js b/test/servers/helpers/ImportServersBtn.test.js
index 58d6c970..269cd300 100644
--- a/test/servers/helpers/ImportServersBtn.test.js
+++ b/test/servers/helpers/ImportServersBtn.test.js
@@ -2,7 +2,7 @@ import React from 'react';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import { UncontrolledTooltip } from 'reactstrap';
-import { ImportServersBtnComponent } from '../../../src/servers/helpers/ImportServersBtn';
+import importServersBtnConstruct from '../../../src/servers/helpers/ImportServersBtn';
describe('', () => {
let wrapper;
@@ -21,13 +21,10 @@ describe('', () => {
serversImporterMock.importServersFromFile.resetHistory();
fileRef.current.click.resetHistory();
+ const ImportServersBtn = importServersBtnConstruct(serversImporterMock);
+
wrapper = shallow(
-
+
);
});
afterEach(() => wrapper.unmount());
diff --git a/test/short-urls/SearchBar.test.js b/test/short-urls/SearchBar.test.js
index 75bc122e..ae811817 100644
--- a/test/short-urls/SearchBar.test.js
+++ b/test/short-urls/SearchBar.test.js
@@ -1,13 +1,14 @@
import React from 'react';
import { shallow } from 'enzyme';
import sinon from 'sinon';
-import { SearchBarComponent } from '../../src/short-urls/SearchBar';
+import searchBarCreator from '../../src/short-urls/SearchBar';
import SearchField from '../../src/utils/SearchField';
-import Tag from '../../src/tags/helpers/Tag';
describe('', () => {
let wrapper;
const listShortUrlsMock = sinon.spy();
+ const Tag = () => '';
+ const SearchBar = searchBarCreator(Tag);
afterEach(() => {
listShortUrlsMock.resetHistory();
@@ -18,13 +19,13 @@ describe('', () => {
});
it('renders a SearchField', () => {
- wrapper = shallow();
+ wrapper = shallow();
expect(wrapper.find(SearchField)).toHaveLength(1);
});
it('renders no tags when the list of tags is empty', () => {
- wrapper = shallow();
+ wrapper = shallow();
expect(wrapper.find(Tag)).toHaveLength(0);
});
@@ -32,13 +33,13 @@ describe('', () => {
it('renders the proper amount of tags', () => {
const tags = [ 'foo', 'bar', 'baz' ];
- wrapper = shallow();
+ wrapper = shallow();
expect(wrapper.find(Tag)).toHaveLength(tags.length);
});
it('updates short URLs list when search field changes', () => {
- wrapper = shallow();
+ wrapper = shallow();
const searchField = wrapper.find(SearchField);
expect(listShortUrlsMock.callCount).toEqual(0);
@@ -48,7 +49,7 @@ describe('', () => {
it('updates short URLs list when a tag is removed', () => {
wrapper = shallow(
-
+
);
const tag = wrapper.find(Tag).first();
diff --git a/test/short-urls/ShortUrls.test.js b/test/short-urls/ShortUrls.test.js
index 9cccc9e9..d2327a31 100644
--- a/test/short-urls/ShortUrls.test.js
+++ b/test/short-urls/ShortUrls.test.js
@@ -1,12 +1,12 @@
import React from 'react';
import { shallow } from 'enzyme';
-import { ShortUrlsComponent as ShortUrls } from '../../src/short-urls/ShortUrls';
+import shortUrlsCreator from '../../src/short-urls/ShortUrls';
import Paginator from '../../src/short-urls/Paginator';
-import ShortUrlsList from '../../src/short-urls/ShortUrlsList';
-import SearchBar from '../../src/short-urls/SearchBar';
-describe('', () => {
+describe('', () => {
let wrapper;
+ const SearchBar = () => '';
+ const ShortUrlsList = () => '';
beforeEach(() => {
const params = {
@@ -14,6 +14,8 @@ describe('', () => {
page: '1',
};
+ const ShortUrls = shortUrlsCreator(SearchBar, ShortUrlsList);
+
wrapper = shallow();
});
afterEach(() => wrapper.unmount());
diff --git a/test/tags/TagsList.test.js b/test/tags/TagsList.test.js
index bf37bd4f..ade440d9 100644
--- a/test/tags/TagsList.test.js
+++ b/test/tags/TagsList.test.js
@@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import { identity, range } from 'ramda';
import * as sinon from 'sinon';
-import { TagsListComponent as TagsList } from '../../src/tags/TagsList';
+import TagsList from '../../src/tags/TagsList';
import MuttedMessage from '../../src/utils/MuttedMessage';
import TagCard from '../../src/tags/TagCard';
import SearchField from '../../src/utils/SearchField';