Skip to content

Commit

Permalink
Fix unit test waring in dr brownfield
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Asir Jeyasingh <[email protected]>
  • Loading branch information
TimothyAsirJeyasing committed Nov 30, 2023
1 parent 9b55fef commit 2dd036b
Showing 1 changed file with 12 additions and 28 deletions.
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
import React from 'react';
import { BLUESTORE, BLUESTORE_RDR } from '@odf/core/constants';
import { cleanup, render, screen, waitFor } from '@testing-library/react';
import { render, screen, waitFor } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';
import { MemoryRouter } from 'react-router-dom';
import { getOSDMigrationStatus } from '../../../../utils/osd-migration';
import { OSDMigrationProgress } from './osd-migration-progress';

jest.mock('@odf/shared/status/icons', () => ({
RedExclamationCircleIcon: 'div',
}));

jest.mock('@openshift-console/dynamic-plugin-sdk-internal', () => ({
HealthBody: 'div',
HealthItem: ({ title }) => <div>{title}</div>,
ViewDocumentation: ({ text, doclink }) => <a href={doclink}>{text}</a>,
HealthState: {
NOT_AVAILABLE: 'NOT_AVAILABLE',
OK: 'OK',
},
HealthItem: ({ title }: { title: string }) => <div>{title}</div>,
}));

jest.mock('../../../../utils/osd-migration');
afterEach(cleanup);

describe('OSDMigrationStatus', () => {
describe('OSDMigrationProgress', () => {
afterEach(() => {
jest.clearAllMocks();
});

test('renders the component with COMPLETED status', async () => {
const cephData = {
status: {
storage: {
osd: {
storeType: {
[BLUESTORE_RDR]: 5,
'bluestore-rdr': 5,
},
},
},
Expand All @@ -39,11 +31,7 @@ describe('OSDMigrationStatus', () => {

getOSDMigrationStatus.mockReturnValue('Completed');

render(
<MemoryRouter>
<OSDMigrationProgress cephData={cephData} />
</MemoryRouter>
);
render(<OSDMigrationProgress cephData={cephData} />);

await waitFor(() => {
expect(
Expand All @@ -58,8 +46,8 @@ describe('OSDMigrationStatus', () => {
storage: {
osd: {
storeType: {
[BLUESTORE]: 10,
[BLUESTORE_RDR]: 5,
bluestore: 10,
'bluestore-rdr': 5,
},
},
},
Expand All @@ -68,11 +56,7 @@ describe('OSDMigrationStatus', () => {

getOSDMigrationStatus.mockReturnValue('In Progress');

render(
<MemoryRouter>
<OSDMigrationProgress cephData={cephData} />
</MemoryRouter>
);
render(<OSDMigrationProgress cephData={cephData} />);

await waitFor(() => {
expect(
Expand Down

0 comments on commit 2dd036b

Please sign in to comment.