mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-03 06:11:48 +00:00
Removed non-needed components which were just wrapping another component that could directly be used instead
This commit is contained in:
@@ -4,10 +4,10 @@ import { NonOrphanVisits as createNonOrphanVisits } from '../../src/visits/NonOr
|
||||
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 { ReportExporter } from '../../src/common/services/ReportExporter';
|
||||
import { SelectedServer } from '../../src/servers/data';
|
||||
import VisitsHeader from '../../src/visits/VisitsHeader';
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
...jest.requireActual('react-router-dom'),
|
||||
@@ -33,14 +33,14 @@ describe('<NonOrphanVisits />', () => {
|
||||
/>,
|
||||
).dive();
|
||||
const stats = wrapper.find(VisitsStats);
|
||||
const header = wrapper.find(NonOrphanVisitsHeader);
|
||||
const header = wrapper.find(VisitsHeader);
|
||||
|
||||
expect(stats).toHaveLength(1);
|
||||
expect(header).toHaveLength(1);
|
||||
expect(stats.prop('cancelGetVisits')).toEqual(cancelGetNonOrphanVisits);
|
||||
expect(stats.prop('visitsInfo')).toEqual(nonOrphanVisits);
|
||||
expect(stats.prop('isOrphanVisits')).not.toBeDefined();
|
||||
expect(header.prop('nonOrphanVisits')).toEqual(nonOrphanVisits);
|
||||
expect(header.prop('visits')).toEqual(nonOrphanVisits.visits);
|
||||
expect(header.prop('goBack')).toEqual(expect.any(Function));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
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('<NonOrphanVisitsHeader />', () => {
|
||||
it('wraps a VisitsHeader with provided data', () => {
|
||||
const visits: Visit[] = [];
|
||||
const orphanVisits = Mock.of<VisitsInfo>({ visits });
|
||||
const goBack = jest.fn();
|
||||
|
||||
const wrapper = shallow(<NonOrphanVisitsHeader nonOrphanVisits={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('Non-orphan visits');
|
||||
});
|
||||
});
|
||||
@@ -4,10 +4,10 @@ import { OrphanVisits as createOrphanVisits } from '../../src/visits/OrphanVisit
|
||||
import { MercureBoundProps } from '../../src/mercure/helpers/boundToMercureHub';
|
||||
import { VisitsInfo } from '../../src/visits/types';
|
||||
import VisitsStats from '../../src/visits/VisitsStats';
|
||||
import { OrphanVisitsHeader } from '../../src/visits/OrphanVisitsHeader';
|
||||
import { Settings } from '../../src/settings/reducers/settings';
|
||||
import { ReportExporter } from '../../src/common/services/ReportExporter';
|
||||
import { SelectedServer } from '../../src/servers/data';
|
||||
import VisitsHeader from '../../src/visits/VisitsHeader';
|
||||
|
||||
jest.mock('react-router-dom', () => ({
|
||||
...jest.requireActual('react-router-dom'),
|
||||
@@ -33,14 +33,14 @@ describe('<OrphanVisits />', () => {
|
||||
/>,
|
||||
).dive();
|
||||
const stats = wrapper.find(VisitsStats);
|
||||
const header = wrapper.find(OrphanVisitsHeader);
|
||||
const header = wrapper.find(VisitsHeader);
|
||||
|
||||
expect(stats).toHaveLength(1);
|
||||
expect(header).toHaveLength(1);
|
||||
expect(stats.prop('cancelGetVisits')).toEqual(cancelGetOrphanVisits);
|
||||
expect(stats.prop('visitsInfo')).toEqual(orphanVisits);
|
||||
expect(stats.prop('isOrphanVisits')).toEqual(true);
|
||||
expect(header.prop('orphanVisits')).toEqual(orphanVisits);
|
||||
expect(header.prop('visits')).toEqual(orphanVisits.visits);
|
||||
expect(header.prop('goBack')).toEqual(expect.any(Function));
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
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');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user