Skip to content

Commit

Permalink
PMM-12710 Fix AddBackupPage unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matejkubinec committed Sep 30, 2024
1 parent 7819484 commit 4cca1a6
Showing 1 changed file with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import { Router } from 'react-router-dom';

import { locationService } from '@grafana/runtime';
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
import { wrapWithGrafanaContextMock } from 'app/percona/shared/helpers/testUtils';
import { configureStore } from 'app/store/configureStore';
import { StoreState } from 'app/types';

import { BackupType } from '../../Backup.types';
import { LocationType } from '../StorageLocations/StorageLocations.types';

import AddBackupPage from './AddBackupPage';
Expand All @@ -18,8 +20,8 @@ jest.mock('../BackupInventory/BackupInventory.service');
jest.mock('./AddBackupPage.service');
jest.mock('app/percona/backup/components/StorageLocations/StorageLocations.service');

const AddBackupPageWrapper: FC<PropsWithChildren> = ({ children }) => {
return (
const AddBackupPageWrapper: FC<PropsWithChildren> = ({ children }) =>
wrapWithGrafanaContextMock(
<Provider
store={configureStore({
percona: {
Expand All @@ -46,7 +48,6 @@ const AddBackupPageWrapper: FC<PropsWithChildren> = ({ children }) => {
<Router history={locationService.getHistory()}>{children}</Router>
</Provider>
);
};

describe('AddBackupPage', () => {
it('should render fields', async () => {
Expand Down Expand Up @@ -77,7 +78,7 @@ describe('AddBackupPage', () => {
<AddBackupPageWrapper>
<AddBackupPage
{...getRouteComponentProps({
match: { params: { type: 'scheduled_task_id', id: '' }, isExact: true, path: '', url: '' },
match: { params: { type: BackupType.SCHEDULED, id: '' }, isExact: true, path: '', url: '' },
})}
/>
</AddBackupPageWrapper>
Expand All @@ -94,7 +95,7 @@ describe('AddBackupPage', () => {
<AddBackupPageWrapper>
<AddBackupPage
{...getRouteComponentProps({
match: { params: { type: 'scheduled_task_id', id: '' }, isExact: true, path: '', url: '' },
match: { params: { type: BackupType.SCHEDULED, id: '' }, isExact: true, path: '', url: '' },
})}
/>
</AddBackupPageWrapper>
Expand Down Expand Up @@ -124,7 +125,7 @@ describe('AddBackupPage', () => {
<AddBackupPageWrapper>
<AddBackupPage
{...getRouteComponentProps({
match: { params: { type: 'scheduled_task_id', id: '' }, isExact: true, path: '', url: '' },
match: { params: { type: BackupType.SCHEDULED, id: '' }, isExact: true, path: '', url: '' },
})}
/>
</AddBackupPageWrapper>
Expand Down Expand Up @@ -157,7 +158,7 @@ describe('AddBackupPage', () => {
<AddBackupPageWrapper>
<AddBackupPage
{...getRouteComponentProps({
match: { params: { type: 'scheduled_task_id', id: '' }, isExact: true, path: '', url: '' },
match: { params: { type: BackupType.SCHEDULED, id: '' }, isExact: true, path: '', url: '' },
})}
/>
</AddBackupPageWrapper>
Expand Down

0 comments on commit 4cca1a6

Please sign in to comment.