diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/DataQuality/TestSummaryGraphUtils.test.ts b/openmetadata-ui/src/main/resources/ui/src/utils/DataQuality/TestSummaryGraphUtils.test.ts index ee4a5ffba2d..997508e400d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/DataQuality/TestSummaryGraphUtils.test.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/DataQuality/TestSummaryGraphUtils.test.ts @@ -99,6 +99,95 @@ describe('prepareChartData', () => { }); }); + it('should handle min/max bound correctly', () => { + const testObj = { + testCaseParameterValue: [], + testCaseResults: [ + { + timestamp: 1720525804736, + testCaseStatus: 'Failed', + result: + 'Found max=1720520076998 vs. the expected min=1720165283528.0, max=1720275283528.0.', + testResultValue: [ + { + name: 'max', + value: '1720520076998', + }, + ], + incidentId: '3093dbee-196b-4284-9f97-7103063d0dd7', + maxBound: 1720275283528, + }, + { + timestamp: 1720525503943, + testCaseStatus: 'Failed', + result: + 'Found max=1720520076998 vs. the expected min=1720165283528.0, max=1720275283528.0.', + testResultValue: [ + { + name: 'max', + value: '1720520076998', + }, + ], + incidentId: '3093dbee-196b-4284-9f97-7103063d0dd7', + minBound: 1720165283528, + }, + { + timestamp: 1720525503943, + testCaseStatus: 'Failed', + result: + 'Found max=1720520076998 vs. the expected min=1720165283528.0, max=1720275283528.0.', + testResultValue: [ + { + name: 'max', + value: '1720520076998', + }, + ], + incidentId: '3093dbee-196b-4284-9f97-7103063d0dd7', + maxBound: 1720275283528, + minBound: 1720165283528, + }, + ], + entityThread: [], + } as PrepareChartDataType; + + const result = prepareChartData(testObj); + + expect(result).toEqual({ + data: [ + { + boundArea: [1720165283528, 1720275283528], + incidentId: '3093dbee-196b-4284-9f97-7103063d0dd7', + max: 1720520076998, + name: 1720525503943, + status: 'Failed', + task: undefined, + }, + { + boundArea: undefined, + incidentId: '3093dbee-196b-4284-9f97-7103063d0dd7', + max: 1720520076998, + name: 1720525503943, + status: 'Failed', + task: undefined, + }, + { + boundArea: undefined, + incidentId: '3093dbee-196b-4284-9f97-7103063d0dd7', + max: 1720520076998, + name: 1720525804736, + status: 'Failed', + task: undefined, + }, + ], + information: [ + { + color: '#7147E8', + label: 'max', + }, + ], + }); + }); + it('should handle empty testCaseParameterValue correctly', () => { const testObj = { testCaseParameterValue: [], diff --git a/openmetadata-ui/src/main/resources/ui/src/utils/DataQuality/TestSummaryGraphUtils.ts b/openmetadata-ui/src/main/resources/ui/src/utils/DataQuality/TestSummaryGraphUtils.ts index e07859597ff..16c40449fae 100644 --- a/openmetadata-ui/src/main/resources/ui/src/utils/DataQuality/TestSummaryGraphUtils.ts +++ b/openmetadata-ui/src/main/resources/ui/src/utils/DataQuality/TestSummaryGraphUtils.ts @@ -55,16 +55,16 @@ export const prepareChartData = ({ ? undefined : `${round(result.failedRowsPercentage, 2)}%`, }; + const y1 = result?.minBound ?? yValues.y1; + const y2 = result?.maxBound ?? yValues.y2; + const boundArea = isUndefined(y1) || isUndefined(y2) ? undefined : [y1, y2]; dataPoints.push({ name: result.timestamp, status: result.testCaseStatus, ...values, ...omitBy(metric, isUndefined), - boundArea: [ - result?.minBound ?? yValues.y1, - result?.maxBound ?? yValues.y2, - ], + boundArea, incidentId: result.incidentId, task: entityThread.find( (task) => task.task?.testCaseResolutionStatusId === result.incidentId