@elisra-devops/docgen-data-provider 1.82.0 → 1.84.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.
@@ -1541,6 +1541,58 @@ describe('ResultDataProvider', () => {
1541
1541
  'Validation Status': 'Fail',
1542
1542
  }));
1543
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
+ });
1544
1596
  it('should produce one detailed row per test case with correct bidirectional discrepancies', async () => {
1545
1597
  const mockDetailedStepsByTestCase = new Map([
1546
1598
  [
@@ -1976,6 +2028,68 @@ describe('ResultDataProvider', () => {
1976
2028
  expect(String(result.rows[0]['Mentioned but Not Linked'] || '')).not.toContain('VVRM');
1977
2029
  expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).not.toContain('VVRM');
1978
2030
  });
2031
+ it('should fallback to work-item fields for steps XML when suite payload has no workItemFields', async () => {
2032
+ jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
2033
+ jest.spyOn(resultDataProvider, 'fetchMewpScopedTestData').mockResolvedValueOnce([
2034
+ {
2035
+ testPointsItems: [{ testCaseId: 501, testCaseName: 'TC 501' }],
2036
+ testCasesItems: [
2037
+ {
2038
+ workItem: {
2039
+ id: 501,
2040
+ workItemFields: [],
2041
+ },
2042
+ },
2043
+ ],
2044
+ },
2045
+ ]);
2046
+ jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([
2047
+ {
2048
+ workItemId: 9001,
2049
+ requirementId: 'SR0501',
2050
+ baseKey: 'SR0501',
2051
+ title: 'Req 501',
2052
+ responsibility: 'ESUK',
2053
+ linkedTestCaseIds: [501],
2054
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
2055
+ },
2056
+ ]);
2057
+ jest.spyOn(resultDataProvider, 'buildLinkedRequirementsByTestCase').mockResolvedValueOnce(new Map([
2058
+ [
2059
+ 501,
2060
+ {
2061
+ baseKeys: new Set(['SR0501']),
2062
+ fullCodes: new Set(['SR0501']),
2063
+ },
2064
+ ],
2065
+ ]));
2066
+ jest.spyOn(resultDataProvider, 'fetchWorkItemsByIds').mockResolvedValueOnce([
2067
+ {
2068
+ id: 501,
2069
+ fields: {
2070
+ 'Microsoft.VSTS.TCM.Steps': '<steps><step id="2" type="ActionStep"><parameterizedString isformatted="true">Action</parameterizedString><parameterizedString isformatted="true">SR0501</parameterizedString></step></steps>',
2071
+ },
2072
+ },
2073
+ ]);
2074
+ jest.spyOn(resultDataProvider.testStepParserHelper, 'parseTestSteps').mockResolvedValueOnce([
2075
+ {
2076
+ stepId: '1',
2077
+ stepPosition: '1',
2078
+ action: 'Action',
2079
+ expected: 'SR0501',
2080
+ isSharedStepTitle: false,
2081
+ },
2082
+ ]);
2083
+ const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
2084
+ expect(resultDataProvider.fetchWorkItemsByIds).toHaveBeenCalled();
2085
+ expect(result.rows).toHaveLength(1);
2086
+ expect(result.rows[0]).toEqual(expect.objectContaining({
2087
+ 'Test Case ID': 501,
2088
+ 'Mentioned but Not Linked': '',
2089
+ 'Linked but Not Mentioned': '',
2090
+ 'Validation Status': 'Pass',
2091
+ }));
2092
+ });
1979
2093
  });
1980
2094
  describe('MEWP rel fallback scoping', () => {
1981
2095
  it('should fallback to previous Rel run when latest selected Rel has no run for a test case', async () => {
@@ -2164,6 +2278,36 @@ describe('ResultDataProvider', () => {
2164
2278
  responsibility: 'ESUK',
2165
2279
  }));
2166
2280
  });
2281
+ it('should resolve external bug responsibility from AreaPath columns when SAPWBS is empty', async () => {
2282
+ const mewpExternalTableUtils = resultDataProvider.mewpExternalTableUtils;
2283
+ jest.spyOn(mewpExternalTableUtils, 'loadExternalTableRows').mockResolvedValueOnce([
2284
+ {
2285
+ Elisra_SortIndex: '101',
2286
+ SR: 'SR0001',
2287
+ TargetWorkItemId: '9011',
2288
+ Title: 'Bug from ATP\\ESUK path',
2289
+ TargetState: 'Active',
2290
+ SAPWBS: '',
2291
+ AreaPath: 'MEWP\\Customer Requirements\\Level 2\\ATP\\ESUK',
2292
+ },
2293
+ {
2294
+ Elisra_SortIndex: '102',
2295
+ SR: 'SR0002',
2296
+ TargetWorkItemId: '9012',
2297
+ Title: 'Bug from ATP path',
2298
+ TargetState: 'Active',
2299
+ SAPWBS: '',
2300
+ 'System.AreaPath': 'MEWP\\Customer Requirements\\Level 2\\ATP',
2301
+ },
2302
+ ]);
2303
+ const map = await resultDataProvider.loadExternalBugsByTestCase(validBugsSource);
2304
+ const bugs101 = map.get(101) || [];
2305
+ const bugs102 = map.get(102) || [];
2306
+ expect(bugs101).toHaveLength(1);
2307
+ expect(bugs102).toHaveLength(1);
2308
+ expect(bugs101[0].responsibility).toBe('ESUK');
2309
+ expect(bugs102[0].responsibility).toBe('Elisra');
2310
+ });
2167
2311
  it('should require Elisra_SortIndex and ignore rows that only provide WorkItemId', async () => {
2168
2312
  const mewpExternalTableUtils = resultDataProvider.mewpExternalTableUtils;
2169
2313
  jest.spyOn(mewpExternalTableUtils, 'loadExternalTableRows').mockResolvedValueOnce([