Enhance NoProfilerBanner component with data-testid attributes and update related tests

This commit is contained in:
Shailesh Parmar 2025-10-14 22:07:46 +05:30
parent 1dfa6b92ba
commit 005d902b10
5 changed files with 14 additions and 5 deletions

View File

@ -48,8 +48,10 @@ const NoProfilerBanner = () => {
</Grid>
<Grid size={9}>
<p className="profiler-title">{t('message.no-profiler-title')}</p>
<p className="profiler-description">
<p className="profiler-title" data-testid="profiler-title">
{t('message.no-profiler-title')}
</p>
<p className="profiler-description" data-testid="profiler-description">
{t('message.no-profiler-message')}
</p>
</Grid>

View File

@ -12,6 +12,7 @@
*/
import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import '../../../../../test/unit/mocks/mui.mock';
import NoProfilerBanner from './NoProfilerBanner.component';
jest.mock('react-router-dom', () => ({
@ -30,7 +31,10 @@ describe('NoProfilerBanner', () => {
expect(
await screen.findByTestId('no-profiler-placeholder')
).toBeInTheDocument();
expect(await screen.findByTestId('error-msg')).toBeInTheDocument();
expect(await screen.findByTestId('profiler-title')).toBeInTheDocument();
expect(
await screen.findByTestId('profiler-description')
).toBeInTheDocument();
expect(await screen.findByTestId('documentation-link')).toBeInTheDocument();
});
});

View File

@ -14,13 +14,13 @@
import { render, screen, waitFor } from '@testing-library/react';
import { AxiosError } from 'axios';
import { DateRangeObject } from 'Models';
import '../../../../../test/unit/mocks/mui.mock';
import { OperationPermission } from '../../../../context/PermissionProvider/PermissionProvider.interface';
import { ColumnProfile } from '../../../../generated/entity/data/container';
import { Table } from '../../../../generated/entity/data/table';
import { Operation } from '../../../../generated/entity/policies/accessControl/resourcePermission';
import { DataType } from '../../../../generated/tests/testDefinition';
import { getColumnProfilerList } from '../../../../rest/tableAPI';
import '../../../../test/unit/mocks/mui.mock';
import { showErrorToast } from '../../../../utils/ToastUtils';
import SingleColumnProfile from './SingleColumnProfile';
import { useTableProfiler } from './TableProfilerProvider';

View File

@ -13,10 +13,10 @@
import { fireEvent, render, screen } from '@testing-library/react';
import QueryString from 'qs';
import { act } from 'react';
import '../../../test/unit/mocks/mui.mock';
import { Table } from '../../generated/entity/data/table';
import { MOCK_PERMISSIONS } from '../../mocks/Glossary.mock';
import { getListTestCaseIncidentStatusFromSearch } from '../../rest/incidentManagerAPI';
import '../../test/unit/mocks/mui.mock';
import IncidentManager from './IncidentManager.component';
jest.mock('../common/NextPrevious/NextPrevious', () => {

View File

@ -11,6 +11,9 @@
* limitations under the License.
*/
import React from 'react';
window.React = React;
/**
* Global mock for Material-UI (MUI) components
* This mock resolves Jest compatibility issues with MUI Grid v2 and theme context