Skip to content

Commit

Permalink
update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
angorayc committed May 5, 2020
1 parent 1dd31e8 commit daf6441
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions x-pack/plugins/siem/public/components/open_timeline/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../pages/timelines/timelines

import { NotePreviews } from './note_previews';
import { OPEN_TIMELINE_CLASS_NAME } from './helpers';
import { TimelineTabsStyle } from './types';

import { StatefulOpenTimeline } from '.';
import { useGetAllTimeline, getAllTimeline } from '../../containers/timeline/all';
jest.mock('../../lib/kibana');
Expand All @@ -29,11 +31,12 @@ jest.mock('../../containers/timeline/all', () => {
};
});
jest.mock('./use_timeline_types', () => {
const originalModule = jest.requireActual('../../containers/timeline/all');
return {
useTimelineTypes: jest.fn().mockReturnValue({
timelineType: 'default',
timelineTabs: <div />,
timelineFilters: <div />,
timelineTabs: <div data-test-subj="timeline-tab" />,
timelineFilters: <div data-test-subj="timeline-filter" />,
}),
};
});
Expand Down Expand Up @@ -499,6 +502,30 @@ describe('StatefulOpenTimeline', () => {
.text()
).toEqual('elastic');
});

test('it renders the title', async () => {
const wrapper = mount(
<ThemeProvider theme={theme}>
<TestProviderWithoutDragAndDrop>
<MockedProvider mocks={mockOpenTimelineQueryResults} addTypename={false}>
<StatefulOpenTimeline
data-test-subj="stateful-timeline"
apolloClient={apolloClient}
isModal={false}
defaultPageSize={DEFAULT_SEARCH_RESULTS_PER_PAGE}
title={title}
/>
</MockedProvider>
</TestProviderWithoutDragAndDrop>
</ThemeProvider>
);

await wait();

expect(wrapper.find(`[data-test-subj="timeline-${TimelineTabsStyle.tab}"]`).exists()).toEqual(
true
);
});
});

describe('#resetSelectionState', () => {
Expand Down

0 comments on commit daf6441

Please sign in to comment.