File tree Expand file tree Collapse file tree
x-pack/plugins/security_solution/public/common/mock/endpoint Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import { PLUGIN_ID } from '../../../../../fleet/common';
2424import { APP_ID } from '../../../../common/constants' ;
2525import { KibanaContextProvider , KibanaServices } from '../../lib/kibana' ;
2626import { MANAGEMENT_APP_ID } from '../../../management/common/constants' ;
27+ import { fleetGetPackageListHttpMock } from '../../../management/pages/endpoint_hosts/mocks' ;
2728
2829type UiRender = ( ui : React . ReactElement , options ?: RenderOptions ) => RenderResult ;
2930
@@ -149,6 +150,9 @@ export const createAppRootMockRenderer = (): AppContextTestRender => {
149150 KibanaServices . init ( globalKibanaServicesParams ) ;
150151 }
151152
153+ // Some APIs need to be mocked right from the start because they are called as soon as the store is initialized
154+ applyDefaultCoreHttpMocks ( coreStart . http ) ;
155+
152156 return {
153157 store,
154158 history,
@@ -181,3 +185,10 @@ const createCoreStartMock = (): ReturnType<typeof coreMock.createStart> => {
181185
182186 return coreStart ;
183187} ;
188+
189+ const applyDefaultCoreHttpMocks = ( http : AppContextTestRender [ 'coreStart' ] [ 'http' ] ) => {
190+ // Need to mock getting the endpoint package from the fleet API because it is used as soon
191+ // as the store middleware for Endpoint list is initialized, thus mocking it here would avoid
192+ // unnecessary errors being output to the console
193+ fleetGetPackageListHttpMock ( http , { ignoreUnMockedApiRouteErrors : true } ) ;
194+ } ;
You can’t perform that action at this time.
0 commit comments