Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
parkiino committed Feb 11, 2021
1 parent 0cb37b0 commit 48bf508
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ export const EndpointDetails = memo(
data-test-subj="policyStatusValue"
href={policyResponseUri}
onClick={policyStatusClickHandler}
onClickAriaLabel={i18n.translate(
'xpack.securitySolution.endpoint.details.policyStatus',
{ defaultMessage: 'Policy Response' }
)}
>
<EuiText size="m">
<FormattedMessage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,27 +647,39 @@ describe('when on the list page', () => {
const renderResult = await renderAndWaitForData();
const policyStatusBadge = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusBadge.textContent).toEqual('Success');
expect(policyStatusBadge.getAttribute('style')).toMatch(
/background-color\: rgb\(109\, 204\, 177\)\;/
);
});

it('should display Warning overall policy status', async () => {
mockEndpointListApi(createPolicyResponse(HostPolicyResponseActionStatus.warning));
const renderResult = await renderAndWaitForData();
const policyStatusBadge = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusBadge.textContent).toEqual('Warning');
expect(policyStatusBadge.getAttribute('style')).toMatch(
/background-color\: rgb\(241\, 216\, 111\)\;/
);
});

it('should display Failed overall policy status', async () => {
mockEndpointListApi(createPolicyResponse(HostPolicyResponseActionStatus.failure));
const renderResult = await renderAndWaitForData();
const policyStatusBadge = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusBadge.textContent).toEqual('Failed');
expect(policyStatusBadge.getAttribute('style')).toMatch(
/background-color\: rgb\(255\, 126\, 98\)\;/
);
});

it('should display Unknown overall policy status', async () => {
mockEndpointListApi(createPolicyResponse('' as HostPolicyResponseActionStatus));
const renderResult = await renderAndWaitForData();
const policyStatusBadge = await renderResult.findByTestId('policyStatusValue');
expect(policyStatusBadge.textContent).toEqual('Unknown');
expect(policyStatusBadge.getAttribute('style')).toMatch(
/background-color\: rgb\(211\, 218\, 230\)\;/
);
});

it('should include the link to reassignment in Ingest', async () => {
Expand Down

0 comments on commit 48bf508

Please sign in to comment.