@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
|
@@ -1078,7 +1078,7 @@ describe('ResultDataProvider', () => {
|
|
|
1078
1078
|
expect(esuk).toBe('ESUK');
|
|
1079
1079
|
expect(il).toBe('IL');
|
|
1080
1080
|
});
|
|
1081
|
-
it('should
|
|
1081
|
+
it('should zip bug rows with L3/L4 pairs and avoid cross-product duplication', () => {
|
|
1082
1082
|
const requirements = [
|
|
1083
1083
|
{
|
|
1084
1084
|
requirementId: 'SR5303',
|
|
@@ -1130,22 +1130,81 @@ describe('ResultDataProvider', () => {
|
|
|
1130
1130
|
[
|
|
1131
1131
|
'SR5303',
|
|
1132
1132
|
[
|
|
1133
|
-
{
|
|
1134
|
-
{ id: '9103', title: 'L4 9103', level: 'L4' },
|
|
1133
|
+
{ l3Id: '9003', l3Title: 'L3 9003', l4Id: '9103', l4Title: 'L4 9103' },
|
|
1135
1134
|
],
|
|
1136
1135
|
],
|
|
1137
1136
|
]);
|
|
1138
1137
|
const rows = resultDataProvider.buildMewpCoverageRows(requirements, requirementIndex, observedTestCaseIdsByRequirement, linkedRequirementsByTestCase, l3l4ByBaseKey, externalBugsByTestCase);
|
|
1139
|
-
expect(rows).toHaveLength(
|
|
1140
|
-
expect(rows.map((row) => row['Bug ID'])).toEqual([10003, 20003
|
|
1141
|
-
expect(rows[
|
|
1138
|
+
expect(rows).toHaveLength(2);
|
|
1139
|
+
expect(rows.map((row) => row['Bug ID'])).toEqual([10003, 20003]);
|
|
1140
|
+
expect(rows[0]).toEqual(expect.objectContaining({
|
|
1142
1141
|
'L3 REQ ID': '9003',
|
|
1143
|
-
'L4 REQ ID': '',
|
|
1142
|
+
'L4 REQ ID': '9103',
|
|
1144
1143
|
}));
|
|
1145
|
-
expect(rows[
|
|
1144
|
+
expect(rows[1]).toEqual(expect.objectContaining({
|
|
1146
1145
|
'L3 REQ ID': '',
|
|
1146
|
+
'L4 REQ ID': '',
|
|
1147
|
+
}));
|
|
1148
|
+
});
|
|
1149
|
+
it('should drop standalone L3 row when same L3 has one or more L4 links', () => {
|
|
1150
|
+
const requirements = [
|
|
1151
|
+
{
|
|
1152
|
+
requirementId: 'SR5310',
|
|
1153
|
+
baseKey: 'SR5310',
|
|
1154
|
+
title: 'Req 5310',
|
|
1155
|
+
subSystem: 'Power',
|
|
1156
|
+
responsibility: 'ESUK',
|
|
1157
|
+
linkedTestCaseIds: [111],
|
|
1158
|
+
},
|
|
1159
|
+
];
|
|
1160
|
+
const requirementIndex = new Map([
|
|
1161
|
+
[
|
|
1162
|
+
'SR5310',
|
|
1163
|
+
new Map([
|
|
1164
|
+
[
|
|
1165
|
+
111,
|
|
1166
|
+
{
|
|
1167
|
+
passed: 1,
|
|
1168
|
+
failed: 0,
|
|
1169
|
+
notRun: 0,
|
|
1170
|
+
},
|
|
1171
|
+
],
|
|
1172
|
+
]),
|
|
1173
|
+
],
|
|
1174
|
+
]);
|
|
1175
|
+
const observedTestCaseIdsByRequirement = new Map([
|
|
1176
|
+
['SR5310', new Set([111])],
|
|
1177
|
+
]);
|
|
1178
|
+
const linkedRequirementsByTestCase = new Map([
|
|
1179
|
+
[
|
|
1180
|
+
111,
|
|
1181
|
+
{
|
|
1182
|
+
baseKeys: new Set(['SR5310']),
|
|
1183
|
+
fullCodes: new Set(['SR5310']),
|
|
1184
|
+
bugIds: new Set(),
|
|
1185
|
+
},
|
|
1186
|
+
],
|
|
1187
|
+
]);
|
|
1188
|
+
const l3l4ByBaseKey = new Map([
|
|
1189
|
+
[
|
|
1190
|
+
'SR5310',
|
|
1191
|
+
[
|
|
1192
|
+
{ l3Id: '9003', l3Title: 'L3 9003', l4Id: '', l4Title: '' },
|
|
1193
|
+
{ l3Id: '9003', l3Title: 'L3 9003', l4Id: '9103', l4Title: 'L4 9103' },
|
|
1194
|
+
{ l3Id: '9003', l3Title: 'L3 9003', l4Id: '9104', l4Title: 'L4 9104' },
|
|
1195
|
+
],
|
|
1196
|
+
],
|
|
1197
|
+
]);
|
|
1198
|
+
const rows = resultDataProvider.buildMewpCoverageRows(requirements, requirementIndex, observedTestCaseIdsByRequirement, linkedRequirementsByTestCase, l3l4ByBaseKey, new Map());
|
|
1199
|
+
expect(rows).toHaveLength(2);
|
|
1200
|
+
expect(rows[0]).toEqual(expect.objectContaining({
|
|
1201
|
+
'L3 REQ ID': '9003',
|
|
1147
1202
|
'L4 REQ ID': '9103',
|
|
1148
1203
|
}));
|
|
1204
|
+
expect(rows[1]).toEqual(expect.objectContaining({
|
|
1205
|
+
'L3 REQ ID': '9003',
|
|
1206
|
+
'L4 REQ ID': '9104',
|
|
1207
|
+
}));
|
|
1149
1208
|
});
|
|
1150
1209
|
it('should not emit bug rows from ADO-linked bug ids when external bugs source is empty', () => {
|
|
1151
1210
|
const requirements = [
|
|
@@ -2142,8 +2201,27 @@ describe('ResultDataProvider', () => {
|
|
|
2142
2201
|
]);
|
|
2143
2202
|
const map = await resultDataProvider.loadExternalL3L4ByBaseKey(validL3L4Source);
|
|
2144
2203
|
expect(map.get('SR0001')).toEqual([
|
|
2145
|
-
{
|
|
2146
|
-
{
|
|
2204
|
+
{ l3Id: '', l3Title: '', l4Id: '7001', l4Title: 'L4 From Level3 Column' },
|
|
2205
|
+
{ l3Id: '7002', l3Title: 'L3 Requirement', l4Id: '', l4Title: '' },
|
|
2206
|
+
]);
|
|
2207
|
+
});
|
|
2208
|
+
it('should emit paired L3+L4 when AREA 34 is Level 4 and both level columns are present', async () => {
|
|
2209
|
+
const mewpExternalTableUtils = resultDataProvider.mewpExternalTableUtils;
|
|
2210
|
+
jest.spyOn(mewpExternalTableUtils, 'loadExternalTableRows').mockResolvedValueOnce([
|
|
2211
|
+
{
|
|
2212
|
+
SR: 'SR0001',
|
|
2213
|
+
'AREA 34': 'Level 4',
|
|
2214
|
+
'TargetWorkItemId Level 3': '7401',
|
|
2215
|
+
TargetTitleLevel3: 'L3 In Level4 Row',
|
|
2216
|
+
'TargetStateLevel 3': 'Active',
|
|
2217
|
+
'TargetWorkItemIdLevel 4': '8401',
|
|
2218
|
+
TargetTitleLevel4: 'L4 In Level4 Row',
|
|
2219
|
+
'TargetStateLevel 4': 'Active',
|
|
2220
|
+
},
|
|
2221
|
+
]);
|
|
2222
|
+
const map = await resultDataProvider.loadExternalL3L4ByBaseKey(validL3L4Source);
|
|
2223
|
+
expect(map.get('SR0001')).toEqual([
|
|
2224
|
+
{ l3Id: '7401', l3Title: 'L3 In Level4 Row', l4Id: '8401', l4Title: 'L4 In Level4 Row' },
|
|
2147
2225
|
]);
|
|
2148
2226
|
});
|
|
2149
2227
|
it('should exclude external open L3/L4 rows when SAPWBS resolves to ESUK', async () => {
|
|
@@ -2172,8 +2250,8 @@ describe('ResultDataProvider', () => {
|
|
|
2172
2250
|
]);
|
|
2173
2251
|
const map = await resultDataProvider.loadExternalL3L4ByBaseKey(validL3L4Source);
|
|
2174
2252
|
expect(map.get('SR0001')).toEqual([
|
|
2175
|
-
{
|
|
2176
|
-
{
|
|
2253
|
+
{ l3Id: '', l3Title: '', l4Id: '7201', l4Title: 'L4 IL' },
|
|
2254
|
+
{ l3Id: '7102', l3Title: 'L3 IL', l4Id: '', l4Title: '' },
|
|
2177
2255
|
]);
|
|
2178
2256
|
});
|
|
2179
2257
|
it('should fallback L3/L4 SAPWBS exclusion from SR-mapped requirement when row SAPWBS is empty', async () => {
|
|
@@ -2201,7 +2279,9 @@ describe('ResultDataProvider', () => {
|
|
|
2201
2279
|
['SR0002', 'IL'],
|
|
2202
2280
|
]));
|
|
2203
2281
|
expect(map.has('SR0001')).toBe(false);
|
|
2204
|
-
expect(map.get('SR0002')).toEqual([
|
|
2282
|
+
expect(map.get('SR0002')).toEqual([
|
|
2283
|
+
{ l3Id: '7302', l3Title: 'L3 From IL Requirement', l4Id: '', l4Title: '' },
|
|
2284
|
+
]);
|
|
2205
2285
|
});
|
|
2206
2286
|
it('should resolve bug responsibility from AreaPath when SAPWBS is empty', () => {
|
|
2207
2287
|
const fromEsukAreaPath = resultDataProvider.resolveBugResponsibility({
|