mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-23 17:40:23 +03:00
Created OrphanVisitsTitle test
This commit is contained in:
parent
115038f80f
commit
d7edd69e60
2 changed files with 22 additions and 2 deletions
|
@ -9,7 +9,6 @@ interface OrphanVisitsHeader {
|
||||||
|
|
||||||
export const OrphanVisitsHeader = ({ orphanVisits, goBack }: OrphanVisitsHeader) => {
|
export const OrphanVisitsHeader = ({ orphanVisits, goBack }: OrphanVisitsHeader) => {
|
||||||
const { visits } = orphanVisits;
|
const { visits } = orphanVisits;
|
||||||
const visitsStatsTitle = <span className="mr-2">Orphan visits</span>;
|
|
||||||
|
|
||||||
return <VisitsHeader title={visitsStatsTitle} goBack={goBack} visits={visits} />;
|
return <VisitsHeader title="Orphan visits" goBack={goBack} visits={visits} />;
|
||||||
};
|
};
|
||||||
|
|
21
test/visits/OrphanVisitsHeader.test.tsx
Normal file
21
test/visits/OrphanVisitsHeader.test.tsx
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
import { shallow } from 'enzyme';
|
||||||
|
import { Mock } from 'ts-mockery';
|
||||||
|
import { OrphanVisitsHeader } from '../../src/visits/OrphanVisitsHeader';
|
||||||
|
import VisitsHeader from '../../src/visits/VisitsHeader';
|
||||||
|
import { Visit, VisitsInfo } from '../../src/visits/types';
|
||||||
|
|
||||||
|
describe('<OrphanVisitsHeader />', () => {
|
||||||
|
it('wraps a VisitsHeader with provided data', () => {
|
||||||
|
const visits: Visit[] = [];
|
||||||
|
const orphanVisits = Mock.of<VisitsInfo>({ visits });
|
||||||
|
const goBack = jest.fn();
|
||||||
|
|
||||||
|
const wrapper = shallow(<OrphanVisitsHeader orphanVisits={orphanVisits} goBack={goBack} />);
|
||||||
|
const visitsHeader = wrapper.find(VisitsHeader);
|
||||||
|
|
||||||
|
expect(visitsHeader).toHaveLength(1);
|
||||||
|
expect(visitsHeader.prop('visits')).toEqual(visits);
|
||||||
|
expect(visitsHeader.prop('goBack')).toEqual(goBack);
|
||||||
|
expect(visitsHeader.prop('title')).toEqual('Orphan visits');
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in a new issue