Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
angorayc committed Apr 29, 2020
1 parent fd3a036 commit bdade71
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,36 @@ import { ThemeProvider } from 'styled-components';
import { wait } from '../../../lib/helpers';
import { TestProviderWithoutDragAndDrop } from '../../../mock/test_providers';
import { mockOpenTimelineQueryResults } from '../../../mock/timeline_results';
import { useGetAllTimeline, getAllTimeline } from '../../../containers/timeline/all';

import { OpenTimelineModal } from '.';

jest.mock('../../../lib/kibana');
jest.mock('../../../utils/apollo_context', () => ({
useApolloClient: () => ({}),
}));
jest.mock('../../../containers/timeline/all', () => {
const originalModule = jest.requireActual('../../../containers/timeline/all');
return {
useGetAllTimeline: jest.fn(),
getAllTimeline: originalModule.getAllTimeline,
};
});

describe('OpenTimelineModal', () => {
const theme = () => ({ eui: euiDarkVars, darkMode: true });
beforeEach(() => {
((useGetAllTimeline as unknown) as jest.Mock).mockReturnValue({
fetchAllTimeline: jest.fn(),
timelines: getAllTimeline(
'',
mockOpenTimelineQueryResults[0].result.data?.getAllTimeline?.timeline ?? []
),
loading: false,
totalCount: mockOpenTimelineQueryResults[0].result.data.getAllTimeline.totalCount,
refetch: jest.fn(),
});
});

test('it renders the expected modal', async () => {
const wrapper = mount(
Expand Down

0 comments on commit bdade71

Please sign in to comment.