mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-09 15:32:25 +00:00
Minor(ui):Made certification always visible (#21135)
* added certification always visible * fixed unit test * fixed unit test
This commit is contained in:
parent
112dc4be1f
commit
faf4373ca2
@ -692,23 +692,21 @@ export const DataAssetsHeader = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{(dataAsset as Table)?.certification && (
|
<Divider className="self-center vertical-divider" type="vertical" />
|
||||||
<>
|
|
||||||
<Divider
|
|
||||||
className="self-center vertical-divider"
|
|
||||||
type="vertical"
|
|
||||||
/>
|
|
||||||
<ExtraInfoLabel
|
<ExtraInfoLabel
|
||||||
|
dataTestId="certification-label"
|
||||||
label={t('label.certification')}
|
label={t('label.certification')}
|
||||||
value={
|
value={
|
||||||
|
(dataAsset as Table).certification ? (
|
||||||
<CertificationTag
|
<CertificationTag
|
||||||
showName
|
showName
|
||||||
certification={(dataAsset as Table).certification!}
|
certification={(dataAsset as Table).certification!}
|
||||||
/>
|
/>
|
||||||
|
) : (
|
||||||
|
t('label.no-entity', { entity: t('label.certification') })
|
||||||
|
)
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</>
|
|
||||||
)}
|
|
||||||
{extraInfo}
|
{extraInfo}
|
||||||
</div>
|
</div>
|
||||||
<div className="mt-2">
|
<div className="mt-2">
|
||||||
|
|||||||
@ -12,25 +12,24 @@
|
|||||||
*/
|
*/
|
||||||
import { act, fireEvent, render, screen } from '@testing-library/react';
|
import { act, fireEvent, render, screen } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import { AUTO_PILOT_APP_NAME } from '../../../constants/Applications.constant';
|
||||||
import { EntityType } from '../../../enums/entity.enum';
|
import { EntityType } from '../../../enums/entity.enum';
|
||||||
|
import { ServiceCategory } from '../../../enums/service.enum';
|
||||||
import {
|
import {
|
||||||
Container,
|
Container,
|
||||||
StorageServiceType,
|
StorageServiceType,
|
||||||
} from '../../../generated/entity/data/container';
|
} from '../../../generated/entity/data/container';
|
||||||
import { MOCK_TIER_DATA } from '../../../mocks/TableData.mock';
|
|
||||||
import { getDataQualityLineage } from '../../../rest/lineageAPI';
|
|
||||||
import { getContainerByName } from '../../../rest/storageAPI';
|
|
||||||
import { DEFAULT_ENTITY_PERMISSION } from '../../../utils/PermissionsUtils';
|
|
||||||
import { DataAssetsHeader } from './DataAssetsHeader.component';
|
|
||||||
import { DataAssetsHeaderProps } from './DataAssetsHeader.interface';
|
|
||||||
|
|
||||||
import { AUTO_PILOT_APP_NAME } from '../../../constants/Applications.constant';
|
|
||||||
import { ServiceCategory } from '../../../enums/service.enum';
|
|
||||||
import { DatabaseServiceType } from '../../../generated/entity/services/databaseService';
|
import { DatabaseServiceType } from '../../../generated/entity/services/databaseService';
|
||||||
import { LabelType, State, TagSource } from '../../../generated/tests/testCase';
|
import { LabelType, State, TagSource } from '../../../generated/tests/testCase';
|
||||||
import { AssetCertification } from '../../../generated/type/assetCertification';
|
import { AssetCertification } from '../../../generated/type/assetCertification';
|
||||||
|
import { MOCK_TIER_DATA } from '../../../mocks/TableData.mock';
|
||||||
import { triggerOnDemandApp } from '../../../rest/applicationAPI';
|
import { triggerOnDemandApp } from '../../../rest/applicationAPI';
|
||||||
|
import { getDataQualityLineage } from '../../../rest/lineageAPI';
|
||||||
|
import { getContainerByName } from '../../../rest/storageAPI';
|
||||||
import { ExtraInfoLink } from '../../../utils/DataAssetsHeader.utils';
|
import { ExtraInfoLink } from '../../../utils/DataAssetsHeader.utils';
|
||||||
|
import { DEFAULT_ENTITY_PERMISSION } from '../../../utils/PermissionsUtils';
|
||||||
|
import { DataAssetsHeader } from './DataAssetsHeader.component';
|
||||||
|
import { DataAssetsHeaderProps } from './DataAssetsHeader.interface';
|
||||||
|
|
||||||
const mockProps: DataAssetsHeaderProps = {
|
const mockProps: DataAssetsHeaderProps = {
|
||||||
dataAsset: {
|
dataAsset: {
|
||||||
@ -89,10 +88,12 @@ jest.mock('../../../utils/DataAssetsHeader.utils', () => ({
|
|||||||
})),
|
})),
|
||||||
getEntityExtraInfoLength: jest.fn().mockImplementation(() => 0),
|
getEntityExtraInfoLength: jest.fn().mockImplementation(() => 0),
|
||||||
isDataAssetsWithServiceField: jest.fn().mockImplementation(() => true),
|
isDataAssetsWithServiceField: jest.fn().mockImplementation(() => true),
|
||||||
ExtraInfoLabel: jest.fn().mockImplementation(({ label, value }) => (
|
ExtraInfoLabel: jest
|
||||||
<div>
|
.fn()
|
||||||
|
.mockImplementation(({ label, value, dataTestId }) => (
|
||||||
|
<div data-testid={dataTestId}>
|
||||||
{label && <span>{label}</span>}
|
{label && <span>{label}</span>}
|
||||||
<span>{value}</span>
|
<div>{value}</div>
|
||||||
</div>
|
</div>
|
||||||
)),
|
)),
|
||||||
ExtraInfoLink: jest.fn().mockImplementation(({ value, href, newTab }) => {
|
ExtraInfoLink: jest.fn().mockImplementation(({ value, href, newTab }) => {
|
||||||
@ -317,7 +318,7 @@ describe('DataAssetsHeader component', () => {
|
|||||||
expect(screen.queryByTestId('source-url-button')).not.toBeInTheDocument();
|
expect(screen.queryByTestId('source-url-button')).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render certification when certification is present', () => {
|
it('should always render certification', () => {
|
||||||
const mockCertification: AssetCertification = {
|
const mockCertification: AssetCertification = {
|
||||||
tagLabel: {
|
tagLabel: {
|
||||||
tagFQN: 'Certification.Bronze',
|
tagFQN: 'Certification.Bronze',
|
||||||
@ -335,7 +336,9 @@ describe('DataAssetsHeader component', () => {
|
|||||||
appliedDate: 1732814645688,
|
appliedDate: 1732814645688,
|
||||||
expiryDate: 1735406645688,
|
expiryDate: 1735406645688,
|
||||||
};
|
};
|
||||||
render(
|
|
||||||
|
// First test with certification
|
||||||
|
const { unmount } = render(
|
||||||
<DataAssetsHeader
|
<DataAssetsHeader
|
||||||
{...mockProps}
|
{...mockProps}
|
||||||
dataAsset={{
|
dataAsset={{
|
||||||
@ -350,6 +353,16 @@ describe('DataAssetsHeader component', () => {
|
|||||||
const certificatComponent = screen.getByText(`CertificationTag`);
|
const certificatComponent = screen.getByText(`CertificationTag`);
|
||||||
|
|
||||||
expect(certificatComponent).toBeInTheDocument();
|
expect(certificatComponent).toBeInTheDocument();
|
||||||
|
|
||||||
|
// Clean up the first render before rendering again
|
||||||
|
unmount();
|
||||||
|
|
||||||
|
// Second test without certification
|
||||||
|
render(<DataAssetsHeader {...mockProps} />);
|
||||||
|
|
||||||
|
expect(screen.getByTestId('certification-label')).toContainHTML(
|
||||||
|
'label.no-entity'
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should trigger the AutoPilot application when the button is clicked', () => {
|
it('should trigger the AutoPilot application when the button is clicked', () => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user