mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-01-10 18:27:25 +03:00
Created TagVisitsHeader test
This commit is contained in:
parent
3a53298417
commit
52631e629e
1 changed files with 33 additions and 0 deletions
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();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue