mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-12-11 02:09:53 -06:00
34 lines
826 B
JavaScript
34 lines
826 B
JavaScript
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();
|
|
});
|
|
});
|