@elisra-devops/docgen-data-provider 1.89.0 → 1.91.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.
@@ -1557,7 +1557,7 @@ describe('ResultDataProvider', () => {
1557
1557
  'Validation Status': 'Fail',
1558
1558
  }));
1559
1559
  });
1560
- it('should emit Direction A rows with step context for missing sibling links', async () => {
1560
+ it('should emit Direction A rows only for specifically mentioned child requirements', async () => {
1561
1561
  jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
1562
1562
  jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
1563
1563
  jest.spyOn(resultDataProvider, 'fetchTestData').mockResolvedValueOnce([
@@ -1599,7 +1599,7 @@ describe('ResultDataProvider', () => {
1599
1599
  stepId: '2',
1600
1600
  stepPosition: '2',
1601
1601
  action: '',
1602
- expected: 'SR0001; SR0002',
1602
+ expected: 'SR0001-1',
1603
1603
  isSharedStepTitle: false,
1604
1604
  },
1605
1605
  ]);
@@ -1675,6 +1675,100 @@ describe('ResultDataProvider', () => {
1675
1675
  'Validation Status': 'Pass',
1676
1676
  }));
1677
1677
  });
1678
+ it('should support cross-test-case family coverage when siblings are linked on different test cases', async () => {
1679
+ jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
1680
+ jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
1681
+ jest.spyOn(resultDataProvider, 'fetchTestData').mockResolvedValueOnce([
1682
+ {
1683
+ testPointsItems: [
1684
+ { testCaseId: 501, testCaseName: 'TC 501 - sibling 1' },
1685
+ { testCaseId: 502, testCaseName: 'TC 502 - sibling 2' },
1686
+ ],
1687
+ testCasesItems: [
1688
+ {
1689
+ workItem: {
1690
+ id: 501,
1691
+ workItemFields: [{ key: 'Steps', value: '<steps id=\"mock-steps-tc-501\"></steps>' }],
1692
+ },
1693
+ },
1694
+ {
1695
+ workItem: {
1696
+ id: 502,
1697
+ workItemFields: [{ key: 'Steps', value: '<steps id=\"mock-steps-tc-502\"></steps>' }],
1698
+ },
1699
+ },
1700
+ ],
1701
+ },
1702
+ ]);
1703
+ jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([
1704
+ {
1705
+ workItemId: 9301,
1706
+ requirementId: 'SR0054-1',
1707
+ baseKey: 'SR0054',
1708
+ title: 'SR0054 child 1',
1709
+ responsibility: 'ESUK',
1710
+ linkedTestCaseIds: [],
1711
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
1712
+ },
1713
+ {
1714
+ workItemId: 9302,
1715
+ requirementId: 'SR0054-2',
1716
+ baseKey: 'SR0054',
1717
+ title: 'SR0054 child 2',
1718
+ responsibility: 'ESUK',
1719
+ linkedTestCaseIds: [],
1720
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
1721
+ },
1722
+ ]);
1723
+ jest.spyOn(resultDataProvider, 'buildLinkedRequirementsByTestCase').mockResolvedValueOnce(new Map([
1724
+ [
1725
+ 501,
1726
+ {
1727
+ baseKeys: new Set(['SR0054']),
1728
+ fullCodes: new Set(['SR0054-1']),
1729
+ },
1730
+ ],
1731
+ [
1732
+ 502,
1733
+ {
1734
+ baseKeys: new Set(['SR0054']),
1735
+ fullCodes: new Set(['SR0054-2']),
1736
+ },
1737
+ ],
1738
+ ]));
1739
+ jest
1740
+ .spyOn(resultDataProvider.testStepParserHelper, 'parseTestSteps')
1741
+ .mockResolvedValueOnce([
1742
+ {
1743
+ stepId: '1',
1744
+ stepPosition: '1',
1745
+ action: 'Parent mention on first test case',
1746
+ expected: 'SR0054',
1747
+ isSharedStepTitle: false,
1748
+ },
1749
+ ])
1750
+ .mockResolvedValueOnce([
1751
+ {
1752
+ stepId: '1',
1753
+ stepPosition: '1',
1754
+ action: 'Parent mention on second test case',
1755
+ expected: 'SR0054',
1756
+ isSharedStepTitle: false,
1757
+ },
1758
+ ]);
1759
+ const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
1760
+ const byTestCase = new Map(result.rows.map((row) => [Number(row['Test Case ID']), row]));
1761
+ expect(byTestCase.get(501)).toEqual(expect.objectContaining({
1762
+ 'Mentioned but Not Linked': '',
1763
+ 'Linked but Not Mentioned': '',
1764
+ 'Validation Status': 'Pass',
1765
+ }));
1766
+ expect(byTestCase.get(502)).toEqual(expect.objectContaining({
1767
+ 'Mentioned but Not Linked': '',
1768
+ 'Linked but Not Mentioned': '',
1769
+ 'Validation Status': 'Pass',
1770
+ }));
1771
+ });
1678
1772
  it('should group linked-but-not-mentioned requirements by SR family', async () => {
1679
1773
  jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
1680
1774
  jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
@@ -2111,7 +2205,7 @@ describe('ResultDataProvider', () => {
2111
2205
  expect(new Set(result.rows.map((row) => row['Test Case ID']))).toEqual(new Set([201, 202, 203]));
2112
2206
  expect(byTestCase.get(201)).toEqual(expect.objectContaining({
2113
2207
  'Test Case Title': 'TC 201 - Mixed discrepancies',
2114
- 'Mentioned but Not Linked': 'Step 1: SR0095-3\nSR0511: SR0511-1, SR0511-2',
2208
+ 'Mentioned but Not Linked': 'Step 1: SR0095-3',
2115
2209
  'Linked but Not Mentioned': 'SR8888',
2116
2210
  'Validation Status': 'Fail',
2117
2211
  }));