mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-05-28 16:16:24 +00:00
Created TagVisitsHeader test
This commit is contained in:
33
test/visits/TagVisitsHeader.test.js
Normal file
33
test/visits/TagVisitsHeader.test.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
|
import Tag from '../../src/tags/helpers/Tag';
|
||||||
|
import TagVisitsHeader from '../../src/visits/TagVisitsHeader';
|
||||||
|
|
||||||
|
describe('<TagVisitsHeader />', () => {
|
||||||
|
let wrapper;
|
||||||
|
const tagVisits = {
|
||||||
|
tag: 'foo',
|
||||||
|
visits: [{}, {}, {}],
|
||||||
|
};
|
||||||
|
const goBack = jest.fn();
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
wrapper = shallow(
|
||||||
|
<TagVisitsHeader tagVisits={tagVisits} goBack={goBack} colorGenerator={{}} />
|
||||||
|
);
|
||||||
|
});
|
||||||
|
afterEach(() => wrapper.unmount());
|
||||||
|
|
||||||
|
it('shows expected visits', () => {
|
||||||
|
expect(wrapper.prop('visits')).toEqual(tagVisits.visits);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('shows title for tag', () => {
|
||||||
|
const title = shallow(wrapper.prop('title'));
|
||||||
|
const tag = title.find(Tag).first();
|
||||||
|
|
||||||
|
expect(tag.prop('text')).toEqual(tagVisits.tag);
|
||||||
|
|
||||||
|
title.unmount();
|
||||||
|
});
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user