@elisra-devops/docgen-data-provider 1.80.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 +7 -7
- package/bin/modules/ResultDataProvider.js +42 -39
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +93 -13
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/bin/utils/mewpExternalIngestionUtils.d.ts +2 -2
- package/bin/utils/mewpExternalIngestionUtils.js +96 -41
- package/bin/utils/mewpExternalIngestionUtils.js.map +1 -1
- package/package.json +1 -1
- package/src/models/mewp-reporting.ts +8 -7
- package/src/modules/ResultDataProvider.ts +49 -61
- package/src/tests/modules/ResultDataProvider.test.ts +113 -13
- package/src/utils/mewpExternalIngestionUtils.ts +95 -47
|
@@ -14,7 +14,6 @@ export interface MewpCoverageRequestOptions {
|
|
|
14
14
|
useRelFallback?: boolean;
|
|
15
15
|
externalBugsFile?: MewpExternalFileRef | null;
|
|
16
16
|
externalL3L4File?: MewpExternalFileRef | null;
|
|
17
|
-
mergeDuplicateL2Cells?: boolean;
|
|
18
17
|
}
|
|
19
18
|
export interface MewpInternalValidationRequestOptions {
|
|
20
19
|
useRelFallback?: boolean;
|
|
@@ -62,17 +61,18 @@ export interface MewpL3L4Link {
|
|
|
62
61
|
title: string;
|
|
63
62
|
level: 'L3' | 'L4';
|
|
64
63
|
}
|
|
65
|
-
export interface
|
|
66
|
-
id: number | '';
|
|
67
|
-
title: string;
|
|
68
|
-
responsibility: string;
|
|
69
|
-
}
|
|
70
|
-
export interface MewpCoverageL3L4Cell {
|
|
64
|
+
export interface MewpL3L4Pair {
|
|
71
65
|
l3Id: string;
|
|
72
66
|
l3Title: string;
|
|
73
67
|
l4Id: string;
|
|
74
68
|
l4Title: string;
|
|
75
69
|
}
|
|
70
|
+
export interface MewpCoverageBugCell {
|
|
71
|
+
id: number | '';
|
|
72
|
+
title: string;
|
|
73
|
+
responsibility: string;
|
|
74
|
+
}
|
|
75
|
+
export type MewpCoverageL3L4Cell = MewpL3L4Pair;
|
|
76
76
|
export interface MewpCoverageRow {
|
|
77
77
|
'L2 REQ ID': string;
|
|
78
78
|
'L2 REQ Title': string;
|
|
@@ -761,38 +761,45 @@ class ResultDataProvider {
|
|
|
761
761
|
createEmptyMewpCoverageL3L4Cell() {
|
|
762
762
|
return { l3Id: '', l3Title: '', l4Id: '', l4Title: '' };
|
|
763
763
|
}
|
|
764
|
-
buildMewpCoverageL3L4Rows(
|
|
764
|
+
buildMewpCoverageL3L4Rows(pairs) {
|
|
765
765
|
const deduped = new Map();
|
|
766
|
-
for (const
|
|
767
|
-
const
|
|
768
|
-
const
|
|
769
|
-
|
|
766
|
+
for (const pair of pairs || []) {
|
|
767
|
+
const l3Id = String((pair === null || pair === void 0 ? void 0 : pair.l3Id) || '').trim();
|
|
768
|
+
const l3Title = String((pair === null || pair === void 0 ? void 0 : pair.l3Title) || '').trim();
|
|
769
|
+
const l4Id = String((pair === null || pair === void 0 ? void 0 : pair.l4Id) || '').trim();
|
|
770
|
+
const l4Title = String((pair === null || pair === void 0 ? void 0 : pair.l4Title) || '').trim();
|
|
771
|
+
if (!l3Id && !l4Id)
|
|
772
|
+
continue;
|
|
773
|
+
const key = `${l3Id}|${l4Id}`;
|
|
774
|
+
const existing = deduped.get(key);
|
|
775
|
+
if (!existing) {
|
|
776
|
+
deduped.set(key, { l3Id, l3Title, l4Id, l4Title });
|
|
770
777
|
continue;
|
|
771
|
-
const key = `${level}:${id}`;
|
|
772
|
-
if (!deduped.has(key)) {
|
|
773
|
-
deduped.set(key, {
|
|
774
|
-
id,
|
|
775
|
-
level,
|
|
776
|
-
title: String((item === null || item === void 0 ? void 0 : item.title) || '').trim(),
|
|
777
|
-
});
|
|
778
778
|
}
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
});
|
|
785
|
-
const rows = [];
|
|
786
|
-
for (const item of sorted) {
|
|
787
|
-
const isL3 = item.level === 'L3';
|
|
788
|
-
rows.push({
|
|
789
|
-
l3Id: isL3 ? String((item === null || item === void 0 ? void 0 : item.id) || '').trim() : '',
|
|
790
|
-
l3Title: isL3 ? String((item === null || item === void 0 ? void 0 : item.title) || '').trim() : '',
|
|
791
|
-
l4Id: isL3 ? '' : String((item === null || item === void 0 ? void 0 : item.id) || '').trim(),
|
|
792
|
-
l4Title: isL3 ? '' : String((item === null || item === void 0 ? void 0 : item.title) || '').trim(),
|
|
779
|
+
deduped.set(key, {
|
|
780
|
+
l3Id: existing.l3Id || l3Id,
|
|
781
|
+
l3Title: existing.l3Title || l3Title,
|
|
782
|
+
l4Id: existing.l4Id || l4Id,
|
|
783
|
+
l4Title: existing.l4Title || l4Title,
|
|
793
784
|
});
|
|
794
785
|
}
|
|
795
|
-
|
|
786
|
+
const normalizedPairs = [...deduped.values()];
|
|
787
|
+
const l3KeysWithAnyL4 = new Set(normalizedPairs
|
|
788
|
+
.filter((item) => !!String((item === null || item === void 0 ? void 0 : item.l3Id) || '').trim() && !!String((item === null || item === void 0 ? void 0 : item.l4Id) || '').trim())
|
|
789
|
+
.map((item) => String((item === null || item === void 0 ? void 0 : item.l3Id) || '').trim().toLowerCase()));
|
|
790
|
+
const filtered = normalizedPairs.filter((item) => {
|
|
791
|
+
const l3Id = String((item === null || item === void 0 ? void 0 : item.l3Id) || '').trim();
|
|
792
|
+
const l4Id = String((item === null || item === void 0 ? void 0 : item.l4Id) || '').trim();
|
|
793
|
+
if (!l3Id || !!l4Id)
|
|
794
|
+
return true;
|
|
795
|
+
return !l3KeysWithAnyL4.has(l3Id.toLowerCase());
|
|
796
|
+
});
|
|
797
|
+
return filtered.sort((a, b) => {
|
|
798
|
+
const l3Compare = String((a === null || a === void 0 ? void 0 : a.l3Id) || '').localeCompare(String((b === null || b === void 0 ? void 0 : b.l3Id) || ''));
|
|
799
|
+
if (l3Compare !== 0)
|
|
800
|
+
return l3Compare;
|
|
801
|
+
return String((a === null || a === void 0 ? void 0 : a.l4Id) || '').localeCompare(String((b === null || b === void 0 ? void 0 : b.l4Id) || ''));
|
|
802
|
+
});
|
|
796
803
|
}
|
|
797
804
|
buildMewpCoverageRows(requirements, requirementIndex, observedTestCaseIdsByRequirement, linkedRequirementsByTestCase, l3l4ByBaseKey, externalBugsByTestCase, externalJoinKeysByL2) {
|
|
798
805
|
var _a;
|
|
@@ -842,19 +849,15 @@ class ResultDataProvider {
|
|
|
842
849
|
? Array.from(aggregatedBugs.values()).sort((a, b) => a.id - b.id)
|
|
843
850
|
: [];
|
|
844
851
|
const l3l4ForRows = [...externalJoinKeys].flatMap((joinKey) => l3l4ByBaseKey.get(joinKey) || []);
|
|
845
|
-
const bugRows = bugsForRows.
|
|
846
|
-
?
|
|
847
|
-
:
|
|
852
|
+
const bugRows = bugsForRows.map((bug) => ({
|
|
853
|
+
id: Number.isFinite(Number(bug === null || bug === void 0 ? void 0 : bug.id)) && Number(bug === null || bug === void 0 ? void 0 : bug.id) > 0 ? Number(bug === null || bug === void 0 ? void 0 : bug.id) : '',
|
|
854
|
+
title: String((bug === null || bug === void 0 ? void 0 : bug.title) || '').trim(),
|
|
855
|
+
responsibility: String((bug === null || bug === void 0 ? void 0 : bug.responsibility) || '').trim(),
|
|
856
|
+
}));
|
|
848
857
|
const l3l4Rows = this.buildMewpCoverageL3L4Rows(l3l4ForRows);
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
}
|
|
853
|
-
for (const bug of bugRows) {
|
|
854
|
-
rows.push(this.createMewpCoverageRow(requirement, runStatus, bug, this.createEmptyMewpCoverageL3L4Cell()));
|
|
855
|
-
}
|
|
856
|
-
for (const linkedL3L4 of l3l4Rows) {
|
|
857
|
-
rows.push(this.createMewpCoverageRow(requirement, runStatus, this.createEmptyMewpCoverageBugCell(), linkedL3L4));
|
|
858
|
+
const rowCount = Math.max(bugRows.length, l3l4Rows.length, 1);
|
|
859
|
+
for (let index = 0; index < rowCount; index += 1) {
|
|
860
|
+
rows.push(this.createMewpCoverageRow(requirement, runStatus, bugRows[index] || this.createEmptyMewpCoverageBugCell(), l3l4Rows[index] || this.createEmptyMewpCoverageL3L4Cell()));
|
|
858
861
|
}
|
|
859
862
|
}
|
|
860
863
|
return rows;
|