diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/log_stream/log_stream.test.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/log_stream/log_stream.test.tsx index a934afb3b0d29..d2dd41e82b2e3 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/log_stream/log_stream.test.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/log_stream/log_stream.test.tsx @@ -9,18 +9,17 @@ import React from 'react'; import { shallow } from 'enzyme'; -import { LogStream } from '../../../../../infra/public'; - import { EntSearchLogStream } from './'; describe('EntSearchLogStream', () => { const mockDateNow = jest.spyOn(global.Date, 'now').mockReturnValue(160000000); describe('renders with default props', () => { - const wrapper = shallow(); + /** As a result of the theme provider being added, we have to extract the child component to correctly assert */ + const wrapper = shallow(shallow().prop('children')); - it('renders a LogStream component', () => { - expect(wrapper.type()).toEqual(LogStream); + it('renders a LogStream (wrapped in React.Suspense) component', () => { + expect(wrapper.type()).toEqual(React.Suspense); }); it('renders with the enterprise search log source ID', () => { @@ -36,7 +35,9 @@ describe('EntSearchLogStream', () => { describe('renders custom props', () => { it('overrides the default props', () => { const wrapper = shallow( - + shallow().prop( + 'children' + ) ); expect(wrapper.prop('sourceId')).toEqual('test'); @@ -45,7 +46,7 @@ describe('EntSearchLogStream', () => { }); it('allows passing a custom hoursAgo that modifies the default start timestamp', () => { - const wrapper = shallow(); + const wrapper = shallow(shallow().prop('children')); expect(wrapper.prop('startTimestamp')).toEqual(156400000); expect(wrapper.prop('endTimestamp')).toEqual(160000000); @@ -53,15 +54,17 @@ describe('EntSearchLogStream', () => { it('allows passing any prop that the LogStream component takes', () => { const wrapper = shallow( - + shallow( + + ).prop('children') ); expect(wrapper.prop('height')).toEqual(500); diff --git a/x-pack/plugins/enterprise_search/public/applications/shared/log_stream/log_stream.tsx b/x-pack/plugins/enterprise_search/public/applications/shared/log_stream/log_stream.tsx index c1f4262881bd2..e826a559451f6 100644 --- a/x-pack/plugins/enterprise_search/public/applications/shared/log_stream/log_stream.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/shared/log_stream/log_stream.tsx @@ -7,6 +7,7 @@ import React from 'react'; +import { EuiThemeProvider } from '../../../../../../../src/plugins/kibana_react/common'; import { LogStream, LogStreamProps } from '../../../../../infra/public'; import { LOGS_SOURCE_ID } from '../../../../common/constants'; @@ -37,11 +38,13 @@ export const EntSearchLogStream: React.FC = ({ if (!startTimestamp) startTimestamp = endTimestamp - hoursAgo * 60 * 60 * 1000; return ( - + + + ); };