mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-02-28 20:56:42 +00:00
Moved all visits-related services to its own service provide function inside visits
This commit is contained in:
@@ -3,7 +3,7 @@ import { shallow } from 'enzyme';
|
||||
import { identity } from 'ramda';
|
||||
import { Card } from 'reactstrap';
|
||||
import * as sinon from 'sinon';
|
||||
import { ShortUrlsVisitsComponent as ShortUrlsVisits } from '../../src/visits/ShortUrlVisits';
|
||||
import createShortUrlVisits from '../../src/visits/ShortUrlVisits';
|
||||
import MutedMessage from '../../src/utils/MuttedMessage';
|
||||
import GraphCard from '../../src/visits/GraphCard';
|
||||
import DateInput from '../../src/utils/DateInput';
|
||||
@@ -18,14 +18,17 @@ describe('<ShortUrlVisits />', () => {
|
||||
};
|
||||
|
||||
const createComponent = (shortUrlVisits) => {
|
||||
const ShortUrlVisits = createShortUrlVisits({
|
||||
processBrowserStats: statsProcessor,
|
||||
processCountriesStats: statsProcessor,
|
||||
processOsStats: statsProcessor,
|
||||
processReferrersStats: statsProcessor,
|
||||
});
|
||||
|
||||
wrapper = shallow(
|
||||
<ShortUrlsVisits
|
||||
<ShortUrlVisits
|
||||
getShortUrlDetail={identity}
|
||||
getShortUrlVisits={getShortUrlVisitsMock}
|
||||
processBrowserStats={statsProcessor}
|
||||
processCountriesStats={statsProcessor}
|
||||
processOsStats={statsProcessor}
|
||||
processReferrersStats={statsProcessor}
|
||||
match={match}
|
||||
shortUrlVisits={shortUrlVisits}
|
||||
shortUrlDetail={{}}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as sinon from 'sinon';
|
||||
import reducer, {
|
||||
_getShortUrlDetail,
|
||||
getShortUrlDetail,
|
||||
GET_SHORT_URL_DETAIL_START,
|
||||
GET_SHORT_URL_DETAIL_ERROR,
|
||||
GET_SHORT_URL_DETAIL,
|
||||
@@ -58,7 +58,7 @@ describe('shortUrlDetailReducer', () => {
|
||||
const ShlinkApiClient = buildApiClientMock(Promise.reject());
|
||||
const expectedDispatchCalls = 2;
|
||||
|
||||
await _getShortUrlDetail(() => ShlinkApiClient, 'abc123')(dispatchMock, getState);
|
||||
await getShortUrlDetail(() => ShlinkApiClient)('abc123')(dispatchMock, getState);
|
||||
|
||||
const [ firstCallArg ] = dispatchMock.getCall(0).args;
|
||||
const { type: firstCallType } = firstCallArg;
|
||||
@@ -77,7 +77,7 @@ describe('shortUrlDetailReducer', () => {
|
||||
const ShlinkApiClient = buildApiClientMock(Promise.resolve(resolvedShortUrl));
|
||||
const expectedDispatchCalls = 2;
|
||||
|
||||
await _getShortUrlDetail(() => ShlinkApiClient, 'abc123')(dispatchMock, getState);
|
||||
await getShortUrlDetail(() => ShlinkApiClient)('abc123')(dispatchMock, getState);
|
||||
|
||||
const [ firstCallArg ] = dispatchMock.getCall(0).args;
|
||||
const { type: firstCallType } = firstCallArg;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import * as sinon from 'sinon';
|
||||
import reducer, {
|
||||
_getShortUrlVisits,
|
||||
getShortUrlVisits,
|
||||
GET_SHORT_URL_VISITS_START,
|
||||
GET_SHORT_URL_VISITS_ERROR,
|
||||
GET_SHORT_URL_VISITS,
|
||||
@@ -58,7 +58,7 @@ describe('shortUrlVisitsReducer', () => {
|
||||
const ShlinkApiClient = buildApiClientMock(Promise.reject());
|
||||
const expectedDispatchCalls = 2;
|
||||
|
||||
await _getShortUrlVisits(() => ShlinkApiClient, 'abc123')(dispatchMock, getState);
|
||||
await getShortUrlVisits(() => ShlinkApiClient)('abc123')(dispatchMock, getState);
|
||||
|
||||
const [ firstCallArg ] = dispatchMock.getCall(0).args;
|
||||
const { type: firstCallType } = firstCallArg;
|
||||
@@ -77,7 +77,7 @@ describe('shortUrlVisitsReducer', () => {
|
||||
const ShlinkApiClient = buildApiClientMock(Promise.resolve(resolvedVisits));
|
||||
const expectedDispatchCalls = 2;
|
||||
|
||||
await _getShortUrlVisits(() => ShlinkApiClient, 'abc123')(dispatchMock, getState);
|
||||
await getShortUrlVisits(() => ShlinkApiClient)('abc123')(dispatchMock, getState);
|
||||
|
||||
const [ firstCallArg ] = dispatchMock.getCall(0).args;
|
||||
const { type: firstCallType } = firstCallArg;
|
||||
|
||||
Reference in New Issue
Block a user