diff --git a/test/visits/NonOrphanVisits.test.tsx b/test/visits/NonOrphanVisits.test.tsx
new file mode 100644
index 00000000..813d4e89
--- /dev/null
+++ b/test/visits/NonOrphanVisits.test.tsx
@@ -0,0 +1,47 @@
+import { shallow } from 'enzyme';
+import { Mock } from 'ts-mockery';
+import { History, Location } from 'history';
+import { match } from 'react-router';
+import { NonOrphanVisits as createNonOrphanVisits } from '../../src/visits/NonOrphanVisits';
+import { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub';
+import { VisitsInfo } from '../../src/visits/types';
+import VisitsStats from '../../src/visits/VisitsStats';
+import { NonOrphanVisitsHeader } from '../../src/visits/NonOrphanVisitsHeader';
+import { Settings } from '../../src/settings/reducers/settings';
+import { VisitsExporter } from '../../src/visits/services/VisitsExporter';
+import { SelectedServer } from '../../src/servers/data';
+
+describe('', () => {
+ it('wraps visits stats and header', () => {
+ const goBack = jest.fn();
+ const getNonOrphanVisits = jest.fn();
+ const cancelGetNonOrphanVisits = jest.fn();
+ const nonOrphanVisits = Mock.all();
+ const NonOrphanVisits = createNonOrphanVisits(Mock.all());
+
+ const wrapper = shallow(
+ ({ mercureInfo: {} })}
+ getNonOrphanVisits={getNonOrphanVisits}
+ nonOrphanVisits={nonOrphanVisits}
+ cancelGetNonOrphanVisits={cancelGetNonOrphanVisits}
+ history={Mock.of({ goBack })}
+ location={Mock.all()}
+ match={Mock.of({ url: 'the_base_url' })}
+ settings={Mock.all()}
+ selectedServer={Mock.all()}
+ />,
+ ).dive();
+ const stats = wrapper.find(VisitsStats);
+ const header = wrapper.find(NonOrphanVisitsHeader);
+
+ expect(stats).toHaveLength(1);
+ expect(header).toHaveLength(1);
+ expect(stats.prop('cancelGetVisits')).toEqual(cancelGetNonOrphanVisits);
+ expect(stats.prop('visitsInfo')).toEqual(nonOrphanVisits);
+ expect(stats.prop('baseUrl')).toEqual('the_base_url');
+ expect(stats.prop('isOrphanVisits')).not.toBeDefined();
+ expect(header.prop('nonOrphanVisits')).toEqual(nonOrphanVisits);
+ expect(header.prop('goBack')).toEqual(goBack);
+ });
+});
diff --git a/test/visits/NonOrphanVisitsHeader.test.tsx b/test/visits/NonOrphanVisitsHeader.test.tsx
new file mode 100644
index 00000000..ea0f1fdc
--- /dev/null
+++ b/test/visits/NonOrphanVisitsHeader.test.tsx
@@ -0,0 +1,21 @@
+import { shallow } from 'enzyme';
+import { Mock } from 'ts-mockery';
+import { NonOrphanVisitsHeader } from '../../src/visits/NonOrphanVisitsHeader';
+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('Non-orphan visits');
+ });
+});
diff --git a/test/visits/OrphanVisits.test.tsx b/test/visits/OrphanVisits.test.tsx
index 99fef93e..e1f6dc78 100644
--- a/test/visits/OrphanVisits.test.tsx
+++ b/test/visits/OrphanVisits.test.tsx
@@ -1,7 +1,7 @@
import { shallow } from 'enzyme';
import { Mock } from 'ts-mockery';
import { History, Location } from 'history';
-import { match } from 'react-router'; // eslint-disable-line @typescript-eslint/no-unused-vars
+import { match } from 'react-router';
import { OrphanVisits as createOrphanVisits } from '../../src/visits/OrphanVisits';
import { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub';
import { VisitsInfo } from '../../src/visits/types';
@@ -40,6 +40,7 @@ describe('', () => {
expect(stats.prop('cancelGetVisits')).toEqual(cancelGetOrphanVisits);
expect(stats.prop('visitsInfo')).toEqual(orphanVisits);
expect(stats.prop('baseUrl')).toEqual('the_base_url');
+ expect(stats.prop('isOrphanVisits')).toEqual(true);
expect(header.prop('orphanVisits')).toEqual(orphanVisits);
expect(header.prop('goBack')).toEqual(goBack);
});
diff --git a/test/visits/ShortUrlVisits.test.tsx b/test/visits/ShortUrlVisits.test.tsx
index a3d2db5b..6a85a838 100644
--- a/test/visits/ShortUrlVisits.test.tsx
+++ b/test/visits/ShortUrlVisits.test.tsx
@@ -48,6 +48,7 @@ describe('', () => {
const visitHeader = wrapper.find(ShortUrlVisitsHeader);
expect(visitStats).toHaveLength(1);
+ expect(visitStats.prop('isOrphanVisits')).not.toBeDefined();
expect(visitHeader).toHaveLength(1);
});
});
diff --git a/test/visits/TagVisits.test.tsx b/test/visits/TagVisits.test.tsx
index ee1f501a..ca00f9e4 100644
--- a/test/visits/TagVisits.test.tsx
+++ b/test/visits/TagVisits.test.tsx
@@ -44,6 +44,7 @@ describe('', () => {
const visitHeader = wrapper.find(TagVisitsHeader);
expect(visitStats).toHaveLength(1);
+ expect(visitStats.prop('isOrphanVisits')).not.toBeDefined();
expect(visitHeader).toHaveLength(1);
});
});