@elisra-devops/docgen-data-provider 1.86.0 → 1.88.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/modules/ResultDataProvider.d.ts +1 -0
- package/bin/modules/ResultDataProvider.js +130 -12
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +133 -1
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/ResultDataProvider.ts +142 -12
- package/src/tests/modules/ResultDataProvider.test.ts +153 -1
|
@@ -1603,6 +1603,138 @@ describe('ResultDataProvider', () => {
|
|
|
1603
1603
|
}),
|
|
1604
1604
|
]));
|
|
1605
1605
|
});
|
|
1606
|
+
it('should pass when a base SR mention is fully covered by its only linked child', async () => {
|
|
1607
|
+
jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
|
|
1608
|
+
jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
|
|
1609
|
+
jest.spyOn(resultDataProvider, 'fetchTestData').mockResolvedValueOnce([
|
|
1610
|
+
{
|
|
1611
|
+
testPointsItems: [{ testCaseId: 402, testCaseName: 'TC 402 - Single child covered' }],
|
|
1612
|
+
testCasesItems: [
|
|
1613
|
+
{
|
|
1614
|
+
workItem: {
|
|
1615
|
+
id: 402,
|
|
1616
|
+
workItemFields: [{ key: 'Steps', value: '<steps id=\"mock-steps-tc-402\"></steps>' }],
|
|
1617
|
+
},
|
|
1618
|
+
},
|
|
1619
|
+
],
|
|
1620
|
+
},
|
|
1621
|
+
]);
|
|
1622
|
+
jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([
|
|
1623
|
+
{
|
|
1624
|
+
workItemId: 9101,
|
|
1625
|
+
requirementId: 'SR0054',
|
|
1626
|
+
baseKey: 'SR0054',
|
|
1627
|
+
title: 'SR0054 parent',
|
|
1628
|
+
responsibility: 'ESUK',
|
|
1629
|
+
linkedTestCaseIds: [],
|
|
1630
|
+
areaPath: 'MEWP\\Customer Requirements\\Level 2',
|
|
1631
|
+
},
|
|
1632
|
+
{
|
|
1633
|
+
workItemId: 9102,
|
|
1634
|
+
requirementId: 'SR0054-1',
|
|
1635
|
+
baseKey: 'SR0054',
|
|
1636
|
+
title: 'SR0054 child 1',
|
|
1637
|
+
responsibility: 'ESUK',
|
|
1638
|
+
linkedTestCaseIds: [],
|
|
1639
|
+
areaPath: 'MEWP\\Customer Requirements\\Level 2',
|
|
1640
|
+
},
|
|
1641
|
+
]);
|
|
1642
|
+
jest.spyOn(resultDataProvider, 'buildLinkedRequirementsByTestCase').mockResolvedValueOnce(new Map([
|
|
1643
|
+
[
|
|
1644
|
+
402,
|
|
1645
|
+
{
|
|
1646
|
+
baseKeys: new Set(['SR0054']),
|
|
1647
|
+
fullCodes: new Set(['SR0054-1']),
|
|
1648
|
+
},
|
|
1649
|
+
],
|
|
1650
|
+
]));
|
|
1651
|
+
jest.spyOn(resultDataProvider.testStepParserHelper, 'parseTestSteps').mockResolvedValueOnce([
|
|
1652
|
+
{
|
|
1653
|
+
stepId: '3',
|
|
1654
|
+
stepPosition: '3',
|
|
1655
|
+
action: 'Validate family root',
|
|
1656
|
+
expected: 'SR0054',
|
|
1657
|
+
isSharedStepTitle: false,
|
|
1658
|
+
},
|
|
1659
|
+
]);
|
|
1660
|
+
const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
|
|
1661
|
+
expect(result.rows).toHaveLength(1);
|
|
1662
|
+
expect(result.rows[0]).toEqual(expect.objectContaining({
|
|
1663
|
+
'Test Case ID': 402,
|
|
1664
|
+
'Mentioned but Not Linked': '',
|
|
1665
|
+
'Linked but Not Mentioned': '',
|
|
1666
|
+
'Validation Status': 'Pass',
|
|
1667
|
+
}));
|
|
1668
|
+
});
|
|
1669
|
+
it('should group linked-but-not-mentioned requirements by SR family', async () => {
|
|
1670
|
+
jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
|
|
1671
|
+
jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
|
|
1672
|
+
jest.spyOn(resultDataProvider, 'fetchTestData').mockResolvedValueOnce([
|
|
1673
|
+
{
|
|
1674
|
+
testPointsItems: [{ testCaseId: 403, testCaseName: 'TC 403 - Linked only' }],
|
|
1675
|
+
testCasesItems: [
|
|
1676
|
+
{
|
|
1677
|
+
workItem: {
|
|
1678
|
+
id: 403,
|
|
1679
|
+
workItemFields: [{ key: 'Steps', value: '<steps id=\"mock-steps-tc-403\"></steps>' }],
|
|
1680
|
+
},
|
|
1681
|
+
},
|
|
1682
|
+
],
|
|
1683
|
+
},
|
|
1684
|
+
]);
|
|
1685
|
+
jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([
|
|
1686
|
+
{
|
|
1687
|
+
workItemId: 9201,
|
|
1688
|
+
requirementId: 'SR0054-1',
|
|
1689
|
+
baseKey: 'SR0054',
|
|
1690
|
+
title: 'SR0054 child 1',
|
|
1691
|
+
responsibility: 'ESUK',
|
|
1692
|
+
linkedTestCaseIds: [],
|
|
1693
|
+
areaPath: 'MEWP\\Customer Requirements\\Level 2',
|
|
1694
|
+
},
|
|
1695
|
+
{
|
|
1696
|
+
workItemId: 9202,
|
|
1697
|
+
requirementId: 'SR0054-2',
|
|
1698
|
+
baseKey: 'SR0054',
|
|
1699
|
+
title: 'SR0054 child 2',
|
|
1700
|
+
responsibility: 'ESUK',
|
|
1701
|
+
linkedTestCaseIds: [],
|
|
1702
|
+
areaPath: 'MEWP\\Customer Requirements\\Level 2',
|
|
1703
|
+
},
|
|
1704
|
+
{
|
|
1705
|
+
workItemId: 9203,
|
|
1706
|
+
requirementId: 'SR0100-1',
|
|
1707
|
+
baseKey: 'SR0100',
|
|
1708
|
+
title: 'SR0100 child 1',
|
|
1709
|
+
responsibility: 'ESUK',
|
|
1710
|
+
linkedTestCaseIds: [],
|
|
1711
|
+
areaPath: 'MEWP\\Customer Requirements\\Level 2',
|
|
1712
|
+
},
|
|
1713
|
+
]);
|
|
1714
|
+
jest.spyOn(resultDataProvider, 'buildLinkedRequirementsByTestCase').mockResolvedValueOnce(new Map([
|
|
1715
|
+
[
|
|
1716
|
+
403,
|
|
1717
|
+
{
|
|
1718
|
+
baseKeys: new Set(['SR0054', 'SR0100']),
|
|
1719
|
+
fullCodes: new Set(['SR0054-1', 'SR0054-2', 'SR0100-1']),
|
|
1720
|
+
},
|
|
1721
|
+
],
|
|
1722
|
+
]));
|
|
1723
|
+
jest.spyOn(resultDataProvider.testStepParserHelper, 'parseTestSteps').mockResolvedValueOnce([
|
|
1724
|
+
{
|
|
1725
|
+
stepId: '1',
|
|
1726
|
+
stepPosition: '1',
|
|
1727
|
+
action: 'Action only',
|
|
1728
|
+
expected: '',
|
|
1729
|
+
isSharedStepTitle: false,
|
|
1730
|
+
},
|
|
1731
|
+
]);
|
|
1732
|
+
const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
|
|
1733
|
+
expect(result.rows).toHaveLength(1);
|
|
1734
|
+
expect(String(result.rows[0]['Mentioned but Not Linked'] || '')).toBe('');
|
|
1735
|
+
expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).toContain('SR0054: SR0054-1, SR0054-2');
|
|
1736
|
+
expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).toContain('SR0100-1');
|
|
1737
|
+
});
|
|
1606
1738
|
it('should report only base SR when an entire mentioned family is uncovered', async () => {
|
|
1607
1739
|
jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
|
|
1608
1740
|
jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
|
|
@@ -1970,7 +2102,7 @@ describe('ResultDataProvider', () => {
|
|
|
1970
2102
|
expect(new Set(result.rows.map((row) => row['Test Case ID']))).toEqual(new Set([201, 202, 203]));
|
|
1971
2103
|
expect(byTestCase.get(201)).toEqual(expect.objectContaining({
|
|
1972
2104
|
'Test Case Title': 'TC 201 - Mixed discrepancies',
|
|
1973
|
-
'Mentioned but Not Linked': 'Step 1: SR0095-3
|
|
2105
|
+
'Mentioned but Not Linked': 'Step 1: SR0095-3; SR0511: SR0511-1, SR0511-2',
|
|
1974
2106
|
'Linked but Not Mentioned': 'SR8888',
|
|
1975
2107
|
'Validation Status': 'Fail',
|
|
1976
2108
|
}));
|