@elisra-devops/docgen-data-provider 1.90.0 → 1.92.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
  ]);
@@ -1612,6 +1612,63 @@ describe('ResultDataProvider', () => {
1612
1612
  }),
1613
1613
  ]));
1614
1614
  });
1615
+ it('should keep explicit child IDs when multiple specifically mentioned children are missing', async () => {
1616
+ jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
1617
+ jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
1618
+ jest.spyOn(resultDataProvider, 'fetchTestData').mockResolvedValueOnce([
1619
+ {
1620
+ testPointsItems: [{ testCaseId: 111, testCaseName: 'TC 111' }],
1621
+ testCasesItems: [
1622
+ {
1623
+ workItem: {
1624
+ id: 111,
1625
+ workItemFields: [{ key: 'Steps', value: '<steps></steps>' }],
1626
+ },
1627
+ },
1628
+ ],
1629
+ },
1630
+ ]);
1631
+ jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([
1632
+ {
1633
+ workItemId: 5101,
1634
+ requirementId: 'SR0054-1',
1635
+ baseKey: 'SR0054',
1636
+ title: 'Req child 1',
1637
+ responsibility: 'ESUK',
1638
+ linkedTestCaseIds: [],
1639
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
1640
+ },
1641
+ {
1642
+ workItemId: 5102,
1643
+ requirementId: 'SR0054-2',
1644
+ baseKey: 'SR0054',
1645
+ title: 'Req child 2',
1646
+ responsibility: 'ESUK',
1647
+ linkedTestCaseIds: [],
1648
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
1649
+ },
1650
+ ]);
1651
+ jest
1652
+ .spyOn(resultDataProvider, 'buildLinkedRequirementsByTestCase')
1653
+ .mockResolvedValueOnce(new Map([[111, { baseKeys: new Set(), fullCodes: new Set() }]]));
1654
+ jest.spyOn(resultDataProvider.testStepParserHelper, 'parseTestSteps').mockResolvedValueOnce([
1655
+ {
1656
+ stepId: '4',
1657
+ stepPosition: '4',
1658
+ action: '',
1659
+ expected: 'SR0054-1; SR0054-2',
1660
+ isSharedStepTitle: false,
1661
+ },
1662
+ ]);
1663
+ const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
1664
+ expect(result.rows).toHaveLength(1);
1665
+ expect(result.rows[0]).toEqual(expect.objectContaining({
1666
+ 'Test Case ID': 111,
1667
+ 'Mentioned but Not Linked': 'Step 4: SR0054-1; SR0054-2',
1668
+ 'Linked but Not Mentioned': '',
1669
+ 'Validation Status': 'Fail',
1670
+ }));
1671
+ });
1615
1672
  it('should pass when a base SR mention is fully covered by its only linked child', async () => {
1616
1673
  jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
1617
1674
  jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
@@ -1675,6 +1732,100 @@ describe('ResultDataProvider', () => {
1675
1732
  'Validation Status': 'Pass',
1676
1733
  }));
1677
1734
  });
1735
+ it('should support cross-test-case family coverage when siblings are linked on different test cases', async () => {
1736
+ jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
1737
+ jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
1738
+ jest.spyOn(resultDataProvider, 'fetchTestData').mockResolvedValueOnce([
1739
+ {
1740
+ testPointsItems: [
1741
+ { testCaseId: 501, testCaseName: 'TC 501 - sibling 1' },
1742
+ { testCaseId: 502, testCaseName: 'TC 502 - sibling 2' },
1743
+ ],
1744
+ testCasesItems: [
1745
+ {
1746
+ workItem: {
1747
+ id: 501,
1748
+ workItemFields: [{ key: 'Steps', value: '<steps id=\"mock-steps-tc-501\"></steps>' }],
1749
+ },
1750
+ },
1751
+ {
1752
+ workItem: {
1753
+ id: 502,
1754
+ workItemFields: [{ key: 'Steps', value: '<steps id=\"mock-steps-tc-502\"></steps>' }],
1755
+ },
1756
+ },
1757
+ ],
1758
+ },
1759
+ ]);
1760
+ jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([
1761
+ {
1762
+ workItemId: 9301,
1763
+ requirementId: 'SR0054-1',
1764
+ baseKey: 'SR0054',
1765
+ title: 'SR0054 child 1',
1766
+ responsibility: 'ESUK',
1767
+ linkedTestCaseIds: [],
1768
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
1769
+ },
1770
+ {
1771
+ workItemId: 9302,
1772
+ requirementId: 'SR0054-2',
1773
+ baseKey: 'SR0054',
1774
+ title: 'SR0054 child 2',
1775
+ responsibility: 'ESUK',
1776
+ linkedTestCaseIds: [],
1777
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
1778
+ },
1779
+ ]);
1780
+ jest.spyOn(resultDataProvider, 'buildLinkedRequirementsByTestCase').mockResolvedValueOnce(new Map([
1781
+ [
1782
+ 501,
1783
+ {
1784
+ baseKeys: new Set(['SR0054']),
1785
+ fullCodes: new Set(['SR0054-1']),
1786
+ },
1787
+ ],
1788
+ [
1789
+ 502,
1790
+ {
1791
+ baseKeys: new Set(['SR0054']),
1792
+ fullCodes: new Set(['SR0054-2']),
1793
+ },
1794
+ ],
1795
+ ]));
1796
+ jest
1797
+ .spyOn(resultDataProvider.testStepParserHelper, 'parseTestSteps')
1798
+ .mockResolvedValueOnce([
1799
+ {
1800
+ stepId: '1',
1801
+ stepPosition: '1',
1802
+ action: 'Parent mention on first test case',
1803
+ expected: 'SR0054',
1804
+ isSharedStepTitle: false,
1805
+ },
1806
+ ])
1807
+ .mockResolvedValueOnce([
1808
+ {
1809
+ stepId: '1',
1810
+ stepPosition: '1',
1811
+ action: 'Parent mention on second test case',
1812
+ expected: 'SR0054',
1813
+ isSharedStepTitle: false,
1814
+ },
1815
+ ]);
1816
+ const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
1817
+ const byTestCase = new Map(result.rows.map((row) => [Number(row['Test Case ID']), row]));
1818
+ expect(byTestCase.get(501)).toEqual(expect.objectContaining({
1819
+ 'Mentioned but Not Linked': '',
1820
+ 'Linked but Not Mentioned': '',
1821
+ 'Validation Status': 'Pass',
1822
+ }));
1823
+ expect(byTestCase.get(502)).toEqual(expect.objectContaining({
1824
+ 'Mentioned but Not Linked': '',
1825
+ 'Linked but Not Mentioned': '',
1826
+ 'Validation Status': 'Pass',
1827
+ }));
1828
+ });
1678
1829
  it('should group linked-but-not-mentioned requirements by SR family', async () => {
1679
1830
  jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
1680
1831
  jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
@@ -1741,7 +1892,9 @@ describe('ResultDataProvider', () => {
1741
1892
  const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
1742
1893
  expect(result.rows).toHaveLength(1);
1743
1894
  expect(String(result.rows[0]['Mentioned but Not Linked'] || '')).toBe('');
1744
- expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).toContain('SR0054: SR0054-1, SR0054-2');
1895
+ expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).toContain('SR0054');
1896
+ expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).not.toContain('SR0054-1');
1897
+ expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).not.toContain('SR0054-2');
1745
1898
  expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).toContain('SR0100-1');
1746
1899
  });
1747
1900
  it('should report only base SR when an entire mentioned family is uncovered', async () => {
@@ -2111,7 +2264,7 @@ describe('ResultDataProvider', () => {
2111
2264
  expect(new Set(result.rows.map((row) => row['Test Case ID']))).toEqual(new Set([201, 202, 203]));
2112
2265
  expect(byTestCase.get(201)).toEqual(expect.objectContaining({
2113
2266
  'Test Case Title': 'TC 201 - Mixed discrepancies',
2114
- 'Mentioned but Not Linked': 'Step 1: SR0095-3\nSR0511: SR0511-1, SR0511-2',
2267
+ 'Mentioned but Not Linked': 'Step 1: SR0095-3; SR0511',
2115
2268
  'Linked but Not Mentioned': 'SR8888',
2116
2269
  'Validation Status': 'Fail',
2117
2270
  }));