mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-04-22 22:46:19 +00:00
Removed remaining usages of sinon
This commit is contained in:
@@ -2,7 +2,6 @@ import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { identity } from 'ramda';
|
||||
import { Card } from 'reactstrap';
|
||||
import * as sinon from 'sinon';
|
||||
import createShortUrlVisits from '../../src/visits/ShortUrlVisits';
|
||||
import MutedMessage from '../../src/utils/MuttedMessage';
|
||||
import GraphCard from '../../src/visits/GraphCard';
|
||||
@@ -14,7 +13,7 @@ describe('<ShortUrlVisits />', () => {
|
||||
const processStatsFromVisits = () => (
|
||||
{ os: {}, browsers: {}, referrers: {}, countries: {}, cities: {}, citiesForMap: {} }
|
||||
);
|
||||
const getShortUrlVisitsMock = sinon.spy();
|
||||
const getShortUrlVisitsMock = jest.fn();
|
||||
const match = {
|
||||
params: { shortCode: 'abc123' },
|
||||
};
|
||||
@@ -37,11 +36,8 @@ describe('<ShortUrlVisits />', () => {
|
||||
};
|
||||
|
||||
afterEach(() => {
|
||||
getShortUrlVisitsMock.resetHistory();
|
||||
|
||||
if (wrapper) {
|
||||
wrapper.unmount();
|
||||
}
|
||||
getShortUrlVisitsMock.mockReset();
|
||||
wrapper && wrapper.unmount();
|
||||
});
|
||||
|
||||
it('renders a preloader when visits are loading', () => {
|
||||
@@ -88,13 +84,12 @@ describe('<ShortUrlVisits />', () => {
|
||||
it('reloads visits when selected dates change', () => {
|
||||
const wrapper = createComponent({ loading: false, error: false, visits: [{}, {}, {}] });
|
||||
const dateInput = wrapper.find(DateInput).first();
|
||||
const expectedGetShortUrlVisitsCalls = 4;
|
||||
|
||||
dateInput.simulate('change', '2016-01-01T00:00:00+01:00');
|
||||
dateInput.simulate('change', '2016-01-02T00:00:00+01:00');
|
||||
dateInput.simulate('change', '2016-01-03T00:00:00+01:00');
|
||||
|
||||
expect(getShortUrlVisitsMock.callCount).toEqual(expectedGetShortUrlVisitsCalls);
|
||||
expect(getShortUrlVisitsMock).toHaveBeenCalledTimes(4);
|
||||
expect(wrapper.state('startDate')).toEqual('2016-01-03T00:00:00+01:00');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user