mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-25 18:30:00 +00:00
Minor: fixed testSummaryGraph issue (#17115)
This commit is contained in:
parent
3df3e6ef71
commit
00278ce369
@ -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', () => {
|
it('should handle empty testCaseParameterValue correctly', () => {
|
||||||
const testObj = {
|
const testObj = {
|
||||||
testCaseParameterValue: [],
|
testCaseParameterValue: [],
|
||||||
|
@ -55,16 +55,16 @@ export const prepareChartData = ({
|
|||||||
? undefined
|
? undefined
|
||||||
: `${round(result.failedRowsPercentage, 2)}%`,
|
: `${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({
|
dataPoints.push({
|
||||||
name: result.timestamp,
|
name: result.timestamp,
|
||||||
status: result.testCaseStatus,
|
status: result.testCaseStatus,
|
||||||
...values,
|
...values,
|
||||||
...omitBy(metric, isUndefined),
|
...omitBy(metric, isUndefined),
|
||||||
boundArea: [
|
boundArea,
|
||||||
result?.minBound ?? yValues.y1,
|
|
||||||
result?.maxBound ?? yValues.y2,
|
|
||||||
],
|
|
||||||
incidentId: result.incidentId,
|
incidentId: result.incidentId,
|
||||||
task: entityThread.find(
|
task: entityThread.find(
|
||||||
(task) => task.task?.testCaseResolutionStatusId === result.incidentId
|
(task) => task.task?.testCaseResolutionStatusId === result.incidentId
|
||||||
|
Loading…
x
Reference in New Issue
Block a user