Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrykkopycinski committed Jul 21, 2020
1 parent dc98afc commit 0b0598a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { shallow, ShallowWrapper } from 'enzyme';
import React from 'react';

import { useKibana } from '../../common/lib/kibana';
import { TimelinesPage } from './timelines_page';
import { TimelinesPageComponent } from './timelines_page';

jest.mock('react-router-dom', () => {
const originalModule = jest.requireActual('react-router-dom');
Expand All @@ -21,6 +21,16 @@ jest.mock('react-router-dom', () => {
};
});
jest.mock('../../overview/components/events_by_dataset');
jest.mock('../../common/containers/source', () => {
const originalModule = jest.requireActual('../../common/containers/source');

return {
...originalModule,
useWithSource: jest.fn().mockReturnValue({
indicesExist: true,
}),
};
});
jest.mock('../../common/lib/kibana', () => {
const originalModule = jest.requireActual('../../common/lib/kibana');

Expand All @@ -46,7 +56,7 @@ describe('TimelinesPageComponent', () => {
},
},
});
wrapper = shallow(<TimelinesPage />);
wrapper = shallow(<TimelinesPageComponent />);
});

afterAll(() => {
Expand Down Expand Up @@ -92,7 +102,7 @@ describe('TimelinesPageComponent', () => {
},
},
});
wrapper = shallow(<TimelinesPage />);
wrapper = shallow(<TimelinesPageComponent />);
});

afterAll(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const TimelinesContainer = styled.div`

export const DEFAULT_SEARCH_RESULTS_PER_PAGE = 10;

const TimelinesPageComponent: React.FC = () => {
export const TimelinesPageComponent: React.FC = () => {
const { tabName } = useParams();
const [importDataModalToggle, setImportDataModalToggle] = useState<boolean>(false);
const onImportTimelineBtnClick = useCallback(() => {
Expand Down

0 comments on commit 0b0598a

Please sign in to comment.