From d7edd69e60d20bb7cdb1fc39cc27c0bc4472a342 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 28 Feb 2021 08:52:31 +0100 Subject: [PATCH] Created OrphanVisitsTitle test --- src/visits/OrphanVisitsHeader.tsx | 3 +-- test/visits/OrphanVisitsHeader.test.tsx | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test/visits/OrphanVisitsHeader.test.tsx diff --git a/src/visits/OrphanVisitsHeader.tsx b/src/visits/OrphanVisitsHeader.tsx index dd600523..87ab78f0 100644 --- a/src/visits/OrphanVisitsHeader.tsx +++ b/src/visits/OrphanVisitsHeader.tsx @@ -9,7 +9,6 @@ interface OrphanVisitsHeader { export const OrphanVisitsHeader = ({ orphanVisits, goBack }: OrphanVisitsHeader) => { const { visits } = orphanVisits; - const visitsStatsTitle = Orphan visits; - return ; + return ; }; diff --git a/test/visits/OrphanVisitsHeader.test.tsx b/test/visits/OrphanVisitsHeader.test.tsx new file mode 100644 index 00000000..66eccad0 --- /dev/null +++ b/test/visits/OrphanVisitsHeader.test.tsx @@ -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('', () => { + it('wraps a VisitsHeader with provided data', () => { + const visits: Visit[] = []; + const orphanVisits = Mock.of({ visits }); + const goBack = jest.fn(); + + const wrapper = shallow(); + 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'); + }); +});