@elisra-devops/docgen-data-provider 1.84.0 → 1.85.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/modules/ResultDataProvider.d.ts +2 -0
- package/bin/modules/ResultDataProvider.js +146 -19
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +117 -0
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/ResultDataProvider.ts +162 -16
- package/src/tests/modules/ResultDataProvider.test.ts +147 -0
|
@@ -1078,6 +1078,67 @@ describe('ResultDataProvider', () => {
|
|
|
1078
1078
|
expect(esuk).toBe('ESUK');
|
|
1079
1079
|
expect(il).toBe('IL');
|
|
1080
1080
|
});
|
|
1081
|
+
it('should derive responsibility from Area Path alias when System.AreaPath is missing', () => {
|
|
1082
|
+
const esuk = resultDataProvider.deriveMewpResponsibility({
|
|
1083
|
+
'Custom.SAPWBS': '',
|
|
1084
|
+
'Area Path': 'MEWP\\Customer Requirements\\Level 2\\ATP\\ESUK',
|
|
1085
|
+
});
|
|
1086
|
+
const il = resultDataProvider.deriveMewpResponsibility({
|
|
1087
|
+
'Custom.SAPWBS': '',
|
|
1088
|
+
'Area Path': 'MEWP\\Customer Requirements\\Level 2\\ATP',
|
|
1089
|
+
});
|
|
1090
|
+
expect(esuk).toBe('ESUK');
|
|
1091
|
+
expect(il).toBe('IL');
|
|
1092
|
+
});
|
|
1093
|
+
it('should derive test-case responsibility from testCasesItems area-path fields', async () => {
|
|
1094
|
+
const fetchByIdsSpy = jest
|
|
1095
|
+
.spyOn(resultDataProvider, 'fetchWorkItemsByIds')
|
|
1096
|
+
.mockResolvedValue([]);
|
|
1097
|
+
const map = await resultDataProvider.buildMewpTestCaseResponsibilityMap([
|
|
1098
|
+
{
|
|
1099
|
+
testCasesItems: [
|
|
1100
|
+
{
|
|
1101
|
+
workItem: {
|
|
1102
|
+
id: 101,
|
|
1103
|
+
workItemFields: [{ name: 'Area Path', value: 'MEWP\\Customer Requirements\\Level 2\\ATP' }],
|
|
1104
|
+
},
|
|
1105
|
+
},
|
|
1106
|
+
{
|
|
1107
|
+
workItem: {
|
|
1108
|
+
id: 102,
|
|
1109
|
+
workItemFields: [
|
|
1110
|
+
{ referenceName: 'System.AreaPath', value: 'MEWP\\Customer Requirements\\Level 2\\ATP\\ESUK' },
|
|
1111
|
+
],
|
|
1112
|
+
},
|
|
1113
|
+
},
|
|
1114
|
+
],
|
|
1115
|
+
testPointsItems: [],
|
|
1116
|
+
},
|
|
1117
|
+
], mockProjectName);
|
|
1118
|
+
expect(map.get(101)).toBe('IL');
|
|
1119
|
+
expect(map.get(102)).toBe('ESUK');
|
|
1120
|
+
expect(fetchByIdsSpy).not.toHaveBeenCalled();
|
|
1121
|
+
});
|
|
1122
|
+
it('should derive test-case responsibility from AreaPath even when SAPWBS exists on test-case payload', async () => {
|
|
1123
|
+
jest.spyOn(resultDataProvider, 'fetchWorkItemsByIds').mockResolvedValue([]);
|
|
1124
|
+
const map = await resultDataProvider.buildMewpTestCaseResponsibilityMap([
|
|
1125
|
+
{
|
|
1126
|
+
testCasesItems: [
|
|
1127
|
+
{
|
|
1128
|
+
workItem: {
|
|
1129
|
+
id: 201,
|
|
1130
|
+
workItemFields: [
|
|
1131
|
+
{ referenceName: 'Custom.SAPWBS', value: 'ESUK' },
|
|
1132
|
+
{ referenceName: 'System.AreaPath', value: 'MEWP\\Customer Requirements\\Level 2\\ATP' },
|
|
1133
|
+
],
|
|
1134
|
+
},
|
|
1135
|
+
},
|
|
1136
|
+
],
|
|
1137
|
+
testPointsItems: [],
|
|
1138
|
+
},
|
|
1139
|
+
], mockProjectName);
|
|
1140
|
+
expect(map.get(201)).toBe('IL');
|
|
1141
|
+
});
|
|
1081
1142
|
it('should zip bug rows with L3/L4 pairs and avoid cross-product duplication', () => {
|
|
1082
1143
|
const requirements = [
|
|
1083
1144
|
{
|
|
@@ -1309,6 +1370,62 @@ describe('ResultDataProvider', () => {
|
|
|
1309
1370
|
expect(rows[0]['Bug ID']).toBe(99001);
|
|
1310
1371
|
expect(rows[0]['Bug Responsibility']).toBe('Elisra');
|
|
1311
1372
|
});
|
|
1373
|
+
it('should fallback bug responsibility from test case mapping when external bug row is unknown', () => {
|
|
1374
|
+
const requirements = [
|
|
1375
|
+
{
|
|
1376
|
+
requirementId: 'SR5310',
|
|
1377
|
+
baseKey: 'SR5310',
|
|
1378
|
+
title: 'Req 5310',
|
|
1379
|
+
subSystem: 'Power',
|
|
1380
|
+
responsibility: '',
|
|
1381
|
+
linkedTestCaseIds: [101],
|
|
1382
|
+
},
|
|
1383
|
+
];
|
|
1384
|
+
const requirementIndex = new Map([
|
|
1385
|
+
[
|
|
1386
|
+
'SR5310',
|
|
1387
|
+
new Map([
|
|
1388
|
+
[
|
|
1389
|
+
101,
|
|
1390
|
+
{
|
|
1391
|
+
passed: 0,
|
|
1392
|
+
failed: 1,
|
|
1393
|
+
notRun: 0,
|
|
1394
|
+
},
|
|
1395
|
+
],
|
|
1396
|
+
]),
|
|
1397
|
+
],
|
|
1398
|
+
]);
|
|
1399
|
+
const observedTestCaseIdsByRequirement = new Map([
|
|
1400
|
+
['SR5310', new Set([101])],
|
|
1401
|
+
]);
|
|
1402
|
+
const linkedRequirementsByTestCase = new Map([
|
|
1403
|
+
[
|
|
1404
|
+
101,
|
|
1405
|
+
{
|
|
1406
|
+
baseKeys: new Set(['SR5310']),
|
|
1407
|
+
fullCodes: new Set(['SR5310']),
|
|
1408
|
+
bugIds: new Set([10003]),
|
|
1409
|
+
},
|
|
1410
|
+
],
|
|
1411
|
+
]);
|
|
1412
|
+
const externalBugsByTestCase = new Map([
|
|
1413
|
+
[
|
|
1414
|
+
101,
|
|
1415
|
+
[
|
|
1416
|
+
{
|
|
1417
|
+
id: 10003,
|
|
1418
|
+
title: 'Bug 10003',
|
|
1419
|
+
responsibility: 'Unknown',
|
|
1420
|
+
requirementBaseKey: 'SR5310',
|
|
1421
|
+
},
|
|
1422
|
+
],
|
|
1423
|
+
],
|
|
1424
|
+
]);
|
|
1425
|
+
const rows = resultDataProvider.buildMewpCoverageRows(requirements, requirementIndex, observedTestCaseIdsByRequirement, linkedRequirementsByTestCase, new Map(), externalBugsByTestCase, new Map(), new Map([[101, 'IL']]));
|
|
1426
|
+
expect(rows).toHaveLength(1);
|
|
1427
|
+
expect(rows[0]['Bug Responsibility']).toBe('Elisra');
|
|
1428
|
+
});
|
|
1312
1429
|
});
|
|
1313
1430
|
describe('getMewpInternalValidationFlatResults', () => {
|
|
1314
1431
|
it('should skip test cases with no in-scope expected requirements and no linked requirements', async () => {
|