Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EDR Workflows][chore] Change previously added antivirus_registration.mode from optional to required #181986

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ export interface PolicyConfig {
};
};
antivirus_registration: {
mode?: AntivirusRegistrationModes;
mode: AntivirusRegistrationModes;
enabled: boolean;
};
attack_surface_reduction: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,28 +169,4 @@ describe('Policy Form Antivirus Registration Card', () => {
expect(getRadioButton(antivirusTestSubj.syncRadioButton).checked).toBe(true);
});
});

describe('when antivirus_registration.mode is not available (serverless rollout)', () => {
beforeEach(() => {
delete formProps.policy.windows.antivirus_registration.mode;
});

it('should show disabled if `antivirus_registration.enabled` is false', () => {
formProps.policy.windows.antivirus_registration.enabled = false;
render();

expect(getRadioButton(antivirusTestSubj.disabledRadioButton).checked).toBe(true);
expect(getRadioButton(antivirusTestSubj.enabledRadioButton).checked).toBe(false);
expect(getRadioButton(antivirusTestSubj.syncRadioButton).checked).toBe(false);
});

it('should show enabled if `antivirus_registration.enabled` is true', () => {
formProps.policy.windows.antivirus_registration.enabled = true;
render();

expect(getRadioButton(antivirusTestSubj.disabledRadioButton).checked).toBe(false);
expect(getRadioButton(antivirusTestSubj.enabledRadioButton).checked).toBe(true);
expect(getRadioButton(antivirusTestSubj.syncRadioButton).checked).toBe(false);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,7 @@ export const AntivirusRegistrationCard = memo<AntivirusRegistrationCardProps>(
const getTestId = useTestIdGenerator(dataTestSubj);
const isProtectionsAllowed = !useGetProtectionsUnavailableComponent();
const isEditMode = mode === 'edit';

let currentMode: AntivirusRegistrationModes;
if (policy.windows.antivirus_registration.mode) {
currentMode = policy.windows.antivirus_registration.mode;
} else {
currentMode = policy.windows.antivirus_registration.enabled
? AntivirusRegistrationModes.enabled
: AntivirusRegistrationModes.disabled;
}
const currentMode = policy.windows.antivirus_registration.mode;

const labels: Record<AntivirusRegistrationModes, React.ReactNode> = useMemo(
() => ({
Expand Down