mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-22 06:26:19 +00:00
More components migrated for dependency injection
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user