@elisra-devops/docgen-data-provider 1.81.0 → 1.83.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.
@@ -1146,6 +1146,66 @@ describe('ResultDataProvider', () => {
1146
1146
  'L4 REQ ID': '',
1147
1147
  }));
1148
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',
1202
+ 'L4 REQ ID': '9103',
1203
+ }));
1204
+ expect(rows[1]).toEqual(expect.objectContaining({
1205
+ 'L3 REQ ID': '9003',
1206
+ 'L4 REQ ID': '9104',
1207
+ }));
1208
+ });
1149
1209
  it('should not emit bug rows from ADO-linked bug ids when external bugs source is empty', () => {
1150
1210
  const requirements = [
1151
1211
  {
@@ -1481,6 +1541,58 @@ describe('ResultDataProvider', () => {
1481
1541
  'Validation Status': 'Fail',
1482
1542
  }));
1483
1543
  });
1544
+ it('should not flag linked child as Direction B when parent family is mentioned in Expected Result', async () => {
1545
+ jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
1546
+ jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
1547
+ jest.spyOn(resultDataProvider, 'fetchTestData').mockResolvedValueOnce([
1548
+ {
1549
+ testPointsItems: [{ testCaseId: 301, testCaseName: 'TC 301' }],
1550
+ testCasesItems: [
1551
+ {
1552
+ workItem: {
1553
+ id: 301,
1554
+ workItemFields: [{ key: 'Steps', value: '<steps></steps>' }],
1555
+ },
1556
+ },
1557
+ ],
1558
+ },
1559
+ ]);
1560
+ jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([
1561
+ {
1562
+ workItemId: 7001,
1563
+ requirementId: 'SR0054',
1564
+ baseKey: 'SR0054',
1565
+ title: 'Parent 0054',
1566
+ responsibility: 'ESUK',
1567
+ linkedTestCaseIds: [],
1568
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
1569
+ },
1570
+ ]);
1571
+ jest.spyOn(resultDataProvider, 'buildLinkedRequirementsByTestCase').mockResolvedValueOnce(new Map([
1572
+ [
1573
+ 301,
1574
+ {
1575
+ baseKeys: new Set(['SR0054']),
1576
+ fullCodes: new Set(['SR0054-1']),
1577
+ },
1578
+ ],
1579
+ ]));
1580
+ jest.spyOn(resultDataProvider.testStepParserHelper, 'parseTestSteps').mockResolvedValueOnce([
1581
+ {
1582
+ stepId: '1',
1583
+ stepPosition: '1',
1584
+ action: '',
1585
+ expected: 'SR0054',
1586
+ isSharedStepTitle: false,
1587
+ },
1588
+ ]);
1589
+ const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
1590
+ expect(result.rows).toHaveLength(1);
1591
+ expect(result.rows[0]).toEqual(expect.objectContaining({
1592
+ 'Test Case ID': 301,
1593
+ 'Linked but Not Mentioned': '',
1594
+ }));
1595
+ });
1484
1596
  it('should produce one detailed row per test case with correct bidirectional discrepancies', async () => {
1485
1597
  const mockDetailedStepsByTestCase = new Map([
1486
1598
  [