mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-19 04:56:17 +00:00
More components migrated for dependency injection
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { Route } from 'react-router-dom';
|
||||
import App from '../src/App';
|
||||
import MainHeader from '../src/common/MainHeader';
|
||||
import { identity } from 'ramda';
|
||||
import appFactory from '../src/App';
|
||||
|
||||
describe('<App />', () => {
|
||||
let wrapper;
|
||||
const MainHeader = () => '';
|
||||
|
||||
beforeEach(() => {
|
||||
const App = appFactory(MainHeader, identity, identity, identity);
|
||||
|
||||
wrapper = shallow(<App />);
|
||||
});
|
||||
afterEach(() => wrapper.unmount());
|
||||
|
||||
@@ -2,7 +2,7 @@ import { shallow } from 'enzyme';
|
||||
import { values } from 'ramda';
|
||||
import React from 'react';
|
||||
import * as sinon from 'sinon';
|
||||
import { HomeComponent } from '../../src/common/Home';
|
||||
import Home from '../../src/common/Home';
|
||||
|
||||
describe('<Home />', () => {
|
||||
let wrapped;
|
||||
@@ -15,7 +15,7 @@ describe('<Home />', () => {
|
||||
const createComponent = (props) => {
|
||||
const actualProps = { ...defaultProps, ...props };
|
||||
|
||||
wrapped = shallow(<HomeComponent {...actualProps} />);
|
||||
wrapped = shallow(<Home {...actualProps} />);
|
||||
|
||||
return wrapped;
|
||||
};
|
||||
|
||||
@@ -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