Skip to content

Commit daf6441

Browse files
committed
update unit test
1 parent 1dd31e8 commit daf6441

1 file changed

Lines changed: 29 additions & 2 deletions

File tree

x-pack/plugins/siem/public/components/open_timeline/index.test.tsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import { DEFAULT_SEARCH_RESULTS_PER_PAGE } from '../../pages/timelines/timelines
1717

1818
import { NotePreviews } from './note_previews';
1919
import { OPEN_TIMELINE_CLASS_NAME } from './helpers';
20+
import { TimelineTabsStyle } from './types';
21+
2022
import { StatefulOpenTimeline } from '.';
2123
import { useGetAllTimeline, getAllTimeline } from '../../containers/timeline/all';
2224
jest.mock('../../lib/kibana');
@@ -29,11 +31,12 @@ jest.mock('../../containers/timeline/all', () => {
2931
};
3032
});
3133
jest.mock('./use_timeline_types', () => {
34+
const originalModule = jest.requireActual('../../containers/timeline/all');
3235
return {
3336
useTimelineTypes: jest.fn().mockReturnValue({
3437
timelineType: 'default',
35-
timelineTabs: <div />,
36-
timelineFilters: <div />,
38+
timelineTabs: <div data-test-subj="timeline-tab" />,
39+
timelineFilters: <div data-test-subj="timeline-filter" />,
3740
}),
3841
};
3942
});
@@ -499,6 +502,30 @@ describe('StatefulOpenTimeline', () => {
499502
.text()
500503
).toEqual('elastic');
501504
});
505+
506+
test('it renders the title', async () => {
507+
const wrapper = mount(
508+
<ThemeProvider theme={theme}>
509+
<TestProviderWithoutDragAndDrop>
510+
<MockedProvider mocks={mockOpenTimelineQueryResults} addTypename={false}>
511+
<StatefulOpenTimeline
512+
data-test-subj="stateful-timeline"
513+
apolloClient={apolloClient}
514+
isModal={false}
515+
defaultPageSize={DEFAULT_SEARCH_RESULTS_PER_PAGE}
516+
title={title}
517+
/>
518+
</MockedProvider>
519+
</TestProviderWithoutDragAndDrop>
520+
</ThemeProvider>
521+
);
522+
523+
await wait();
524+
525+
expect(wrapper.find(`[data-test-subj="timeline-${TimelineTabsStyle.tab}"]`).exists()).toEqual(
526+
true
527+
);
528+
});
502529
});
503530

504531
describe('#resetSelectionState', () => {

0 commit comments

Comments
 (0)