Skip to content

Commit

Permalink
add a test for MO 365 V8 configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanMarcMilletScality committed Sep 9, 2024
1 parent 31dc829 commit 562e9a1
Showing 1 changed file with 29 additions and 4 deletions.
33 changes: 29 additions & 4 deletions src/react/ui-elements/Veeam/VeeamConfiguration.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,11 @@ describe('Veeam Configuration UI', () => {
veeamApplicationSelect: () => screen.getByLabelText(/Veeam application/i),
veeamVBO: () =>
screen.getByRole('option', {
name: /Veeam Backup for Microsoft 365/i,
name: /Veeam Backup for Microsoft 365 \(pre-v8\)/i,
}),
veeamVBOV8: () =>
screen.getByRole('option', {
name: /Veeam Backup for Microsoft 365 \(v8\)/i,
}),
};

Expand Down Expand Up @@ -101,7 +105,7 @@ describe('Veeam Configuration UI', () => {
});
});

it('should hide immutable backup and Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 is selected', async () => {
it('should hide immutable backup and Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 pre-v8 is selected', async () => {
//Setup
mockUseAccountsImplementation();
renderVeeamConfigurationForm();
Expand Down Expand Up @@ -131,7 +135,7 @@ describe('Veeam Configuration UI', () => {
expect(screen.getByText(/Cancel/i)).toBeInTheDocument();
});

it('should disable immutable backup when Veeam Backup for Microsoft 365 is selected', async () => {
it('should disable immutable backup when Veeam Backup for Microsoft 365 pre-v8 is selected', async () => {
const SUT = jest.fn();
mockUseStepper.mockReturnValue({ next: SUT });
mockUseAccountsImplementation();
Expand All @@ -145,13 +149,34 @@ describe('Veeam Configuration UI', () => {

expect(SUT).toHaveBeenCalledWith({
accountName: 'Veeam',
application: 'Veeam Backup for Microsoft 365',
application: 'Veeam Backup for Microsoft 365 (pre-v8)',
bucketName: 'veeam-bucket',
capacityBytes: '4294967296',
enableImmutableBackup: false,
});
});

it('should show immutable backup but hide Max Veeam Repository Capacity when Veeam Backup for Microsoft 365 v8 is selected', async () => {
const SUT = jest.fn();
mockUseStepper.mockReturnValue({ next: SUT });
mockUseAccountsImplementation();
renderVeeamConfigurationForm();

await selectClick(selectors.veeamApplicationSelect());
await userEvent.click(selectors.veeamVBOV8());
await userEvent.type(selectors.accountNameInput(), 'Veeam');
await userEvent.type(selectors.repositoryInput(), 'veeam-bucket');
await userEvent.click(selectors.continueButton());

expect(SUT).toHaveBeenCalledWith({
accountName: 'Veeam',
application: 'Veeam Backup for Microsoft 365 (v8)',
bucketName: 'veeam-bucket',
capacityBytes: '4294967296',
enableImmutableBackup: true,
});
});

it('should display error in case of account name already exists', async () => {
//S
mockUseAccountsImplementation();
Expand Down

0 comments on commit 562e9a1

Please sign in to comment.