More components migrated for dependency injection

This commit is contained in:
Alejandro Celaya
2018-12-17 20:24:31 +01:00
parent 79a518b02d
commit 5e6ad14a85
9 changed files with 39 additions and 46 deletions

View File

@@ -2,7 +2,7 @@ import React from 'react';
import { shallow } from 'enzyme';
import { identity } from 'ramda';
import sinon from 'sinon';
import { CreateServerComponent } from '../../src/servers/CreateServer';
import CreateServer from '../../src/servers/CreateServer';
import ImportServersBtn from '../../src/servers/helpers/ImportServersBtn';
describe('<CreateServer />', () => {
@@ -17,11 +17,7 @@ describe('<CreateServer />', () => {
historyMock.push.resetHistory();
wrapper = shallow(
<CreateServerComponent
createServer={createServerMock}
resetSelectedServer={identity}
history={historyMock}
/>
<CreateServer createServer={createServerMock} resetSelectedServer={identity} history={historyMock} />
);
});
afterEach(() => wrapper.unmount());

View File

@@ -49,7 +49,7 @@ describe('selectedServerReducer', () => {
const dispatch = sinon.spy();
const expectedDispatchCalls = 2;
_selectServer(ShlinkApiClientMock, ServersServiceMock, serverId)(dispatch);
_selectServer(ShlinkApiClientMock, ServersServiceMock)(serverId)(dispatch);
expect(dispatch.callCount).toEqual(expectedDispatchCalls);
expect(dispatch.firstCall.calledWith({ type: RESET_SHORT_URL_PARAMS })).toEqual(true);
@@ -60,7 +60,7 @@ describe('selectedServerReducer', () => {
});
it('invokes dependencies', () => {
_selectServer(ShlinkApiClientMock, ServersServiceMock, serverId)(() => {});
_selectServer(ShlinkApiClientMock, ServersServiceMock)(serverId)(() => {});
expect(ShlinkApiClientMock.setConfig.callCount).toEqual(1);
expect(ServersServiceMock.findServerById.callCount).toEqual(1);