@elisra-devops/docgen-data-provider 1.80.0 → 1.81.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.
@@ -1078,7 +1078,7 @@ describe('ResultDataProvider', () => {
1078
1078
  expect(esuk).toBe('ESUK');
1079
1079
  expect(il).toBe('IL');
1080
1080
  });
1081
- it('should emit additive rows for bugs and L3/L4 links without bug duplication', () => {
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,21 +1130,20 @@ describe('ResultDataProvider', () => {
1130
1130
  [
1131
1131
  'SR5303',
1132
1132
  [
1133
- { id: '9003', title: 'L3 9003', level: 'L3' },
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(4);
1140
- expect(rows.map((row) => row['Bug ID'])).toEqual([10003, 20003, '', '']);
1141
- expect(rows[2]).toEqual(expect.objectContaining({
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[3]).toEqual(expect.objectContaining({
1144
+ expect(rows[1]).toEqual(expect.objectContaining({
1146
1145
  'L3 REQ ID': '',
1147
- 'L4 REQ ID': '9103',
1146
+ 'L4 REQ ID': '',
1148
1147
  }));
1149
1148
  });
1150
1149
  it('should not emit bug rows from ADO-linked bug ids when external bugs source is empty', () => {
@@ -2142,8 +2141,27 @@ describe('ResultDataProvider', () => {
2142
2141
  ]);
2143
2142
  const map = await resultDataProvider.loadExternalL3L4ByBaseKey(validL3L4Source);
2144
2143
  expect(map.get('SR0001')).toEqual([
2145
- { id: '7002', title: 'L3 Requirement', level: 'L3' },
2146
- { id: '7001', title: 'L4 From Level3 Column', level: 'L4' },
2144
+ { l3Id: '', l3Title: '', l4Id: '7001', l4Title: 'L4 From Level3 Column' },
2145
+ { l3Id: '7002', l3Title: 'L3 Requirement', l4Id: '', l4Title: '' },
2146
+ ]);
2147
+ });
2148
+ it('should emit paired L3+L4 when AREA 34 is Level 4 and both level columns are present', async () => {
2149
+ const mewpExternalTableUtils = resultDataProvider.mewpExternalTableUtils;
2150
+ jest.spyOn(mewpExternalTableUtils, 'loadExternalTableRows').mockResolvedValueOnce([
2151
+ {
2152
+ SR: 'SR0001',
2153
+ 'AREA 34': 'Level 4',
2154
+ 'TargetWorkItemId Level 3': '7401',
2155
+ TargetTitleLevel3: 'L3 In Level4 Row',
2156
+ 'TargetStateLevel 3': 'Active',
2157
+ 'TargetWorkItemIdLevel 4': '8401',
2158
+ TargetTitleLevel4: 'L4 In Level4 Row',
2159
+ 'TargetStateLevel 4': 'Active',
2160
+ },
2161
+ ]);
2162
+ const map = await resultDataProvider.loadExternalL3L4ByBaseKey(validL3L4Source);
2163
+ expect(map.get('SR0001')).toEqual([
2164
+ { l3Id: '7401', l3Title: 'L3 In Level4 Row', l4Id: '8401', l4Title: 'L4 In Level4 Row' },
2147
2165
  ]);
2148
2166
  });
2149
2167
  it('should exclude external open L3/L4 rows when SAPWBS resolves to ESUK', async () => {
@@ -2172,8 +2190,8 @@ describe('ResultDataProvider', () => {
2172
2190
  ]);
2173
2191
  const map = await resultDataProvider.loadExternalL3L4ByBaseKey(validL3L4Source);
2174
2192
  expect(map.get('SR0001')).toEqual([
2175
- { id: '7102', title: 'L3 IL', level: 'L3' },
2176
- { id: '7201', title: 'L4 IL', level: 'L4' },
2193
+ { l3Id: '', l3Title: '', l4Id: '7201', l4Title: 'L4 IL' },
2194
+ { l3Id: '7102', l3Title: 'L3 IL', l4Id: '', l4Title: '' },
2177
2195
  ]);
2178
2196
  });
2179
2197
  it('should fallback L3/L4 SAPWBS exclusion from SR-mapped requirement when row SAPWBS is empty', async () => {
@@ -2201,7 +2219,9 @@ describe('ResultDataProvider', () => {
2201
2219
  ['SR0002', 'IL'],
2202
2220
  ]));
2203
2221
  expect(map.has('SR0001')).toBe(false);
2204
- expect(map.get('SR0002')).toEqual([{ id: '7302', title: 'L3 From IL Requirement', level: 'L3' }]);
2222
+ expect(map.get('SR0002')).toEqual([
2223
+ { l3Id: '7302', l3Title: 'L3 From IL Requirement', l4Id: '', l4Title: '' },
2224
+ ]);
2205
2225
  });
2206
2226
  it('should resolve bug responsibility from AreaPath when SAPWBS is empty', () => {
2207
2227
  const fromEsukAreaPath = resultDataProvider.resolveBugResponsibility({