Minor: fixed testSummaryGraph issue (#17115)

This commit is contained in:
Shailesh Parmar 2024-07-22 10:07:25 +05:30 committed by GitHub
parent 3df3e6ef71
commit 00278ce369
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 93 additions and 4 deletions

View File

@ -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: [],

View File

@ -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