Skip to content

Commit 85d0973

Browse files
committed
test(dq-dashboard): cover independent Tier/Certification fetch gating
1 parent 66f1dae commit 85d0973

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

openmetadata-ui/src/main/resources/ui/src/components/DataQuality/DataQualityDashboard/DataQualityDashboard.test.tsx

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ jest.mock('../../../components/PageHeader/PageHeader.component', () =>
103103
);
104104

105105
jest.mock('../../../rest/tagAPI', () => ({
106-
getTags: () => mockGetTags(),
106+
getTags: (...args: unknown[]) => mockGetTags(...args),
107107
}));
108108

109109
jest.mock('../../../rest/searchAPI', () => ({
@@ -1088,10 +1088,11 @@ describe('DataQualityDashboard', () => {
10881088
).toBeInTheDocument();
10891089
});
10901090

1091-
it('does not call getTags API when tier is in hiddenFilters', async () => {
1092-
render(<DataQualityDashboard hiddenFilters={['tier']} />, {
1093-
wrapper: MemoryRouter,
1094-
});
1091+
it('does not call getTags API when both tier and certification are in hiddenFilters', async () => {
1092+
render(
1093+
<DataQualityDashboard hiddenFilters={['tier', 'certification']} />,
1094+
{ wrapper: MemoryRouter }
1095+
);
10951096

10961097
await waitFor(() => {
10971098
expect(
@@ -1102,6 +1103,30 @@ describe('DataQualityDashboard', () => {
11021103
expect(mockGetTags).not.toHaveBeenCalled();
11031104
});
11041105

1106+
it('fetches only Certification (not Tier) when tier is in hiddenFilters', async () => {
1107+
render(<DataQualityDashboard hiddenFilters={['tier']} />, {
1108+
wrapper: MemoryRouter,
1109+
});
1110+
1111+
await waitFor(() => {
1112+
expect(mockGetTags).toHaveBeenCalledWith({ parent: 'Certification' });
1113+
});
1114+
1115+
expect(mockGetTags).not.toHaveBeenCalledWith({ parent: 'Tier' });
1116+
});
1117+
1118+
it('fetches only Tier (not Certification) when certification is in hiddenFilters', async () => {
1119+
render(<DataQualityDashboard hiddenFilters={['certification']} />, {
1120+
wrapper: MemoryRouter,
1121+
});
1122+
1123+
await waitFor(() => {
1124+
expect(mockGetTags).toHaveBeenCalledWith({ parent: 'Tier' });
1125+
});
1126+
1127+
expect(mockGetTags).not.toHaveBeenCalledWith({ parent: 'Certification' });
1128+
});
1129+
11051130
it('does not call tag search API when tags is in hiddenFilters', async () => {
11061131
render(
11071132
<DataQualityDashboard hiddenFilters={['tags', 'dataProducts']} />,

0 commit comments

Comments
 (0)