mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 09:30:31 +03:00
Created TagVisits test
This commit is contained in:
parent
52631e629e
commit
4e483dc5d4
1 changed files with 44 additions and 0 deletions
44
test/visits/TagVisits.test.js
Normal file
44
test/visits/TagVisits.test.js
Normal file
|
@ -0,0 +1,44 @@
|
|||
import React from 'react';
|
||||
import { shallow } from 'enzyme';
|
||||
import { identity } from 'ramda';
|
||||
import createTagVisits from '../../src/visits/TagVisits';
|
||||
import TagVisitsHeader from '../../src/visits/TagVisitsHeader';
|
||||
|
||||
describe('<TagVisits />', () => {
|
||||
let wrapper;
|
||||
const getTagVisitsMock = jest.fn();
|
||||
const match = {
|
||||
params: { tag: 'foo' },
|
||||
};
|
||||
const history = {
|
||||
goBack: jest.fn(),
|
||||
};
|
||||
const realTimeUpdates = { enabled: true };
|
||||
const VisitsStats = jest.fn();
|
||||
|
||||
beforeEach(() => {
|
||||
const TagVisits = createTagVisits(VisitsStats, {});
|
||||
|
||||
wrapper = shallow(
|
||||
<TagVisits
|
||||
getTagVisits={getTagVisitsMock}
|
||||
match={match}
|
||||
history={history}
|
||||
tagVisits={{ loading: true, visits: [] }}
|
||||
cancelGetTagVisits={identity}
|
||||
settings={{ realTimeUpdates }}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(() => wrapper.unmount());
|
||||
afterEach(jest.resetAllMocks);
|
||||
|
||||
it('renders visit stats and visits header', () => {
|
||||
const visitStats = wrapper.find(VisitsStats);
|
||||
const visitHeader = wrapper.find(TagVisitsHeader);
|
||||
|
||||
expect(visitStats).toHaveLength(1);
|
||||
expect(visitHeader).toHaveLength(1);
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue