@elisra-devops/docgen-data-provider 1.83.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.
@@ -2028,6 +2028,68 @@ describe('ResultDataProvider', () => {
2028
2028
  expect(String(result.rows[0]['Mentioned but Not Linked'] || '')).not.toContain('VVRM');
2029
2029
  expect(String(result.rows[0]['Linked but Not Mentioned'] || '')).not.toContain('VVRM');
2030
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
+ });
2031
2093
  });
2032
2094
  describe('MEWP rel fallback scoping', () => {
2033
2095
  it('should fallback to previous Rel run when latest selected Rel has no run for a test case', async () => {
@@ -2216,6 +2278,36 @@ describe('ResultDataProvider', () => {
2216
2278
  responsibility: 'ESUK',
2217
2279
  }));
2218
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
+ });
2219
2311
  it('should require Elisra_SortIndex and ignore rows that only provide WorkItemId', async () => {
2220
2312
  const mewpExternalTableUtils = resultDataProvider.mewpExternalTableUtils;
2221
2313
  jest.spyOn(mewpExternalTableUtils, 'loadExternalTableRows').mockResolvedValueOnce([