diff --git a/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_store_management_page.test.tsx b/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_store_management_page.test.tsx index a4cf70b47f4a3..cc15a5360a3d1 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_store_management_page.test.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_store_management_page.test.tsx @@ -29,9 +29,10 @@ jest.mock('../../helper_hooks', () => ({ useHasSecurityCapability: () => mockUseHasSecurityCapability(), })); -const mockUseEntityEngineStatus = jest.fn(); +const mockUseEntityStoreStatus = jest.fn(); jest.mock('../components/entity_store/hooks/use_entity_store', () => ({ - useEntityStoreStatus: () => mockUseEntityEngineStatus(), + ...jest.requireActual('../components/entity_store/hooks/use_entity_store'), + useEntityStoreStatus: () => mockUseEntityStoreStatus(), })); const mockUseEntityEnginePrivileges = jest.fn(); @@ -52,8 +53,10 @@ describe('EntityStoreManagementPage', () => { data: { has_all_required: true }, }); - mockUseEntityEngineStatus.mockReturnValue({ - status: 'running', + mockUseEntityStoreStatus.mockReturnValue({ + data: { + status: 'running', + }, errors: [], }); @@ -79,9 +82,11 @@ describe('EntityStoreManagementPage', () => { expect(screen.getByText('Entity Store')).toBeInTheDocument(); }); - it('disables the switch when status is loading', () => { - mockUseEntityEngineStatus.mockReturnValue({ - status: 'loading', + it('disables the switch when status is installing', () => { + mockUseEntityStoreStatus.mockReturnValue({ + data: { + status: 'installing', + }, errors: [], }); @@ -142,8 +147,10 @@ describe('EntityStoreManagementPage', () => { }); it('switches to the Status tab when clicked', () => { - mockUseEntityEngineStatus.mockReturnValue({ - status: 'running', + mockUseEntityStoreStatus.mockReturnValue({ + data: { + status: 'running', + }, errors: [], }); @@ -161,8 +168,10 @@ describe('EntityStoreManagementPage', () => { }); it('does not render the Status tab when entity store is not installed', () => { - mockUseEntityEngineStatus.mockReturnValue({ - status: 'not_installed', + mockUseEntityStoreStatus.mockReturnValue({ + data: { + status: 'not_installed', + }, errors: [], }); @@ -178,8 +187,10 @@ describe('EntityStoreManagementPage', () => { }); it('does not render the Status tab when privileges are missing', () => { - mockUseEntityEngineStatus.mockReturnValue({ - status: 'running', + mockUseEntityStoreStatus.mockReturnValue({ + data: { + status: 'running', + }, errors: [], }); diff --git a/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_store_management_page.tsx b/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_store_management_page.tsx index d1b7f9afd5aad..c0b9d8d697e53 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_store_management_page.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/pages/entity_store_management_page.tsx @@ -421,10 +421,8 @@ const InsufficientAssetCriticalityPrivilegesCallout: React.FC = () => { ); }; -const AssetCriticalityIssueCallout: React.FC = ({ +const AssetCriticalityIssueCallout: React.FC<{ errorMessage?: string | ReactNode }> = ({ errorMessage, -}: { - errorMessage?: string | ReactNode; }) => { const msg = errorMessage ?? ( { if (!hasEntityAnalyticsCapability || assetCriticalityPrivilegesError?.body.status_code === 403) { - return ; + return ( + + ); } if (!hasAssetCriticalityWritePermissions) { return ;