Skip to content

Commit

Permalink
[Security Solution] Host isolation exceptions by policy, add missing …
Browse files Browse the repository at this point in the history
…validation when no policy is selected (#120500)
  • Loading branch information
academo authored Dec 6, 2021
1 parent f2ef652 commit 9a8d888
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function getEffectedPolicySelectionByTags(
tags: string[],
policies: PolicyData[]
): EffectedPolicySelection {
if (tags.length === 0 || tags.find((tag) => tag === GLOBAL_POLICY_TAG)) {
if (tags.find((tag) => tag === GLOBAL_POLICY_TAG)) {
return {
isGlobal: true,
selected: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,5 +233,21 @@ describe('When on the host isolation exceptions entry form', () => {
'true'
);
});

it('should show the policies selector when no policy is selected', () => {
existingException.tags = [];

renderResult = render(existingException);

expect(renderResult.queryByTestId('effectedPolicies-select-policiesSelectable')).toBeTruthy();
});

it('should show the policies selector when no policy is selected and there are previous tags', () => {
existingException.tags = ['non-a-policy-tag'];

renderResult = render(existingException);

expect(renderResult.queryByTestId('effectedPolicies-select-policiesSelectable')).toBeTruthy();
});
});
});

0 comments on commit 9a8d888

Please sign in to comment.