forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
280 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...k/plugins/security_solution/public/flyout/entity_details/host_details_left/index.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { RISK_INPUTS_TAB_TEST_ID } from '../../../entity_analytics/components/entity_details_flyout'; | ||
import { render } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { HostDetailsPanel } from '.'; | ||
import { TestProviders } from '../../../common/mock'; | ||
|
||
describe('HostDetailsPanel', () => { | ||
it('render risk inputs panel', () => { | ||
const { getByTestId } = render( | ||
<HostDetailsPanel | ||
riskInputs={{ | ||
alertIds: ['test-id-1', 'test-id-2'], | ||
}} | ||
/>, | ||
{ wrapper: TestProviders } | ||
); | ||
expect(getByTestId(RISK_INPUTS_TAB_TEST_ID)).toBeInTheDocument(); | ||
}); | ||
|
||
it("doesn't render risk inputs panel when no alerts ids are provided", () => { | ||
const { queryByTestId } = render( | ||
<HostDetailsPanel | ||
riskInputs={{ | ||
alertIds: [], | ||
}} | ||
/>, | ||
{ wrapper: TestProviders } | ||
); | ||
expect(queryByTestId(RISK_INPUTS_TAB_TEST_ID)).not.toBeInTheDocument(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
...y_solution/public/flyout/entity_details/host_right/fields/endpoint_policy_fields.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { TestProviders } from '../../../../common/mock'; | ||
import { render } from '@testing-library/react'; | ||
import React from 'react'; | ||
import { mockObservedHostData } from '../../mocks'; | ||
import { policyFields } from './endpoint_policy_fields'; | ||
|
||
const TestWrapper = ({ el }: { el: JSX.Element | undefined }) => <>{el}</>; | ||
|
||
jest.mock( | ||
'../../../../management/hooks/response_actions/use_get_endpoint_pending_actions_summary', | ||
() => { | ||
const original = jest.requireActual( | ||
'../../../../management/hooks/response_actions/use_get_endpoint_pending_actions_summary' | ||
); | ||
return { | ||
...original, | ||
useGetEndpointPendingActionsSummary: () => ({ | ||
pendingActions: [], | ||
isLoading: false, | ||
isError: false, | ||
isTimeout: false, | ||
fetch: jest.fn(), | ||
}), | ||
}; | ||
} | ||
); | ||
|
||
describe('Endpoint Policy Fields', () => { | ||
it('renders policy name', () => { | ||
const policyName = policyFields[0]; | ||
|
||
const { container } = render(<TestWrapper el={policyName.render?.(mockObservedHostData)} />); | ||
|
||
expect(container).toHaveTextContent('policy-name'); | ||
}); | ||
|
||
it('renders policy status', () => { | ||
const policyStatus = policyFields[1]; | ||
|
||
const { container } = render(<TestWrapper el={policyStatus.render?.(mockObservedHostData)} />); | ||
|
||
expect(container).toHaveTextContent('failure'); | ||
}); | ||
|
||
it('renders agent status', () => { | ||
const agentStatus = policyFields[3]; | ||
|
||
const { container } = render(<TestWrapper el={agentStatus.render?.(mockObservedHostData)} />, { | ||
wrapper: TestProviders, | ||
}); | ||
|
||
expect(container).toHaveTextContent('Healthy'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.