Skip to content

Commit

Permalink
improve antivirus registration card unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
gergoabraham committed Apr 11, 2024
1 parent dcc1069 commit 2b457bf
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,40 @@ describe('Policy Form Antivirus Registration Card', () => {
render();

expect(renderResult.getByTestId(antivirusTestSubj.radioButtons)).toBeTruthy();

expect(getRadioButton(antivirusTestSubj.disabledRadioButton)).not.toHaveAttribute('disabled');
expect(getRadioButton(antivirusTestSubj.enabledRadioButton)).not.toHaveAttribute('disabled');
expect(getRadioButton(antivirusTestSubj.syncRadioButton)).not.toHaveAttribute('disabled');
});

it('should check `disabled` radio button if `antivirus_registration.mode` is disabled', () => {
formProps.policy.windows.antivirus_registration.mode = AntivirusRegistrationModes.disabled;

render();

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

it('should check `enabled` radio button if `antivirus_registration.mode` is enabled', () => {
formProps.policy.windows.antivirus_registration.mode = AntivirusRegistrationModes.enabled;

render();

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

it('should check `sync` radio button if `antivirus_registration.mode` is sync', () => {
formProps.policy.windows.antivirus_registration.mode = AntivirusRegistrationModes.sync;

render();

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

it('should display for windows OS with restriction', () => {
Expand Down

0 comments on commit 2b457bf

Please sign in to comment.