@elisra-devops/docgen-data-provider 1.81.0 → 1.82.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/models/mewp-reporting.d.ts +0 -1
- package/bin/modules/ResultDataProvider.js +12 -1
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +60 -0
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/models/mewp-reporting.ts +0 -1
- package/src/modules/ResultDataProvider.ts +13 -1
- package/src/tests/modules/ResultDataProvider.test.ts +78 -0
package/package.json
CHANGED
|
@@ -16,7 +16,6 @@ export interface MewpCoverageRequestOptions {
|
|
|
16
16
|
useRelFallback?: boolean;
|
|
17
17
|
externalBugsFile?: MewpExternalFileRef | null;
|
|
18
18
|
externalL3L4File?: MewpExternalFileRef | null;
|
|
19
|
-
mergeDuplicateL2Cells?: boolean;
|
|
20
19
|
}
|
|
21
20
|
|
|
22
21
|
export interface MewpInternalValidationRequestOptions {
|
|
@@ -1113,8 +1113,20 @@ export default class ResultDataProvider {
|
|
|
1113
1113
|
l4Title: existing.l4Title || l4Title,
|
|
1114
1114
|
});
|
|
1115
1115
|
}
|
|
1116
|
+
const normalizedPairs = [...deduped.values()];
|
|
1117
|
+
const l3KeysWithAnyL4 = new Set(
|
|
1118
|
+
normalizedPairs
|
|
1119
|
+
.filter((item) => !!String(item?.l3Id || '').trim() && !!String(item?.l4Id || '').trim())
|
|
1120
|
+
.map((item) => String(item?.l3Id || '').trim().toLowerCase())
|
|
1121
|
+
);
|
|
1122
|
+
const filtered = normalizedPairs.filter((item) => {
|
|
1123
|
+
const l3Id = String(item?.l3Id || '').trim();
|
|
1124
|
+
const l4Id = String(item?.l4Id || '').trim();
|
|
1125
|
+
if (!l3Id || !!l4Id) return true;
|
|
1126
|
+
return !l3KeysWithAnyL4.has(l3Id.toLowerCase());
|
|
1127
|
+
});
|
|
1116
1128
|
|
|
1117
|
-
return
|
|
1129
|
+
return filtered.sort((a, b) => {
|
|
1118
1130
|
const l3Compare = String(a?.l3Id || '').localeCompare(String(b?.l3Id || ''));
|
|
1119
1131
|
if (l3Compare !== 0) return l3Compare;
|
|
1120
1132
|
return String(a?.l4Id || '').localeCompare(String(b?.l4Id || ''));
|
|
@@ -1428,6 +1428,84 @@ describe('ResultDataProvider', () => {
|
|
|
1428
1428
|
);
|
|
1429
1429
|
});
|
|
1430
1430
|
|
|
1431
|
+
it('should drop standalone L3 row when same L3 has one or more L4 links', () => {
|
|
1432
|
+
const requirements = [
|
|
1433
|
+
{
|
|
1434
|
+
requirementId: 'SR5310',
|
|
1435
|
+
baseKey: 'SR5310',
|
|
1436
|
+
title: 'Req 5310',
|
|
1437
|
+
subSystem: 'Power',
|
|
1438
|
+
responsibility: 'ESUK',
|
|
1439
|
+
linkedTestCaseIds: [111],
|
|
1440
|
+
},
|
|
1441
|
+
];
|
|
1442
|
+
|
|
1443
|
+
const requirementIndex = new Map([
|
|
1444
|
+
[
|
|
1445
|
+
'SR5310',
|
|
1446
|
+
new Map([
|
|
1447
|
+
[
|
|
1448
|
+
111,
|
|
1449
|
+
{
|
|
1450
|
+
passed: 1,
|
|
1451
|
+
failed: 0,
|
|
1452
|
+
notRun: 0,
|
|
1453
|
+
},
|
|
1454
|
+
],
|
|
1455
|
+
]),
|
|
1456
|
+
],
|
|
1457
|
+
]);
|
|
1458
|
+
|
|
1459
|
+
const observedTestCaseIdsByRequirement = new Map<string, Set<number>>([
|
|
1460
|
+
['SR5310', new Set([111])],
|
|
1461
|
+
]);
|
|
1462
|
+
|
|
1463
|
+
const linkedRequirementsByTestCase = new Map([
|
|
1464
|
+
[
|
|
1465
|
+
111,
|
|
1466
|
+
{
|
|
1467
|
+
baseKeys: new Set(['SR5310']),
|
|
1468
|
+
fullCodes: new Set(['SR5310']),
|
|
1469
|
+
bugIds: new Set(),
|
|
1470
|
+
},
|
|
1471
|
+
],
|
|
1472
|
+
]);
|
|
1473
|
+
|
|
1474
|
+
const l3l4ByBaseKey = new Map([
|
|
1475
|
+
[
|
|
1476
|
+
'SR5310',
|
|
1477
|
+
[
|
|
1478
|
+
{ l3Id: '9003', l3Title: 'L3 9003', l4Id: '', l4Title: '' },
|
|
1479
|
+
{ l3Id: '9003', l3Title: 'L3 9003', l4Id: '9103', l4Title: 'L4 9103' },
|
|
1480
|
+
{ l3Id: '9003', l3Title: 'L3 9003', l4Id: '9104', l4Title: 'L4 9104' },
|
|
1481
|
+
],
|
|
1482
|
+
],
|
|
1483
|
+
]);
|
|
1484
|
+
|
|
1485
|
+
const rows = (resultDataProvider as any).buildMewpCoverageRows(
|
|
1486
|
+
requirements,
|
|
1487
|
+
requirementIndex,
|
|
1488
|
+
observedTestCaseIdsByRequirement,
|
|
1489
|
+
linkedRequirementsByTestCase,
|
|
1490
|
+
l3l4ByBaseKey,
|
|
1491
|
+
new Map()
|
|
1492
|
+
);
|
|
1493
|
+
|
|
1494
|
+
expect(rows).toHaveLength(2);
|
|
1495
|
+
expect(rows[0]).toEqual(
|
|
1496
|
+
expect.objectContaining({
|
|
1497
|
+
'L3 REQ ID': '9003',
|
|
1498
|
+
'L4 REQ ID': '9103',
|
|
1499
|
+
})
|
|
1500
|
+
);
|
|
1501
|
+
expect(rows[1]).toEqual(
|
|
1502
|
+
expect.objectContaining({
|
|
1503
|
+
'L3 REQ ID': '9003',
|
|
1504
|
+
'L4 REQ ID': '9104',
|
|
1505
|
+
})
|
|
1506
|
+
);
|
|
1507
|
+
});
|
|
1508
|
+
|
|
1431
1509
|
it('should not emit bug rows from ADO-linked bug ids when external bugs source is empty', () => {
|
|
1432
1510
|
const requirements = [
|
|
1433
1511
|
{
|