@elisra-devops/docgen-data-provider 1.103.0 → 1.104.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.
@@ -2921,6 +2921,81 @@ describe('ResultDataProvider', () => {
2921
2921
  'Validation Status': 'Pass',
2922
2922
  }));
2923
2923
  });
2924
+ it('should prefer latest test-case revision fields (title/description/steps) in internal validation flow', async () => {
2925
+ jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
2926
+ jest.spyOn(resultDataProvider, 'fetchMewpScopedTestData').mockResolvedValueOnce([
2927
+ {
2928
+ testPointsItems: [{ testCaseId: 777, testCaseName: 'TC 777 (snapshot)' }],
2929
+ testCasesItems: [
2930
+ {
2931
+ workItem: {
2932
+ id: 777,
2933
+ workItemFields: [
2934
+ { key: 'System.Title', value: 'TC 777 (snapshot title)' },
2935
+ {
2936
+ key: 'Microsoft.VSTS.TCM.Steps',
2937
+ value: '<steps><step id="2" type="ActionStep"><parameterizedString isformatted="true">Action</parameterizedString><parameterizedString isformatted="true">SR0001</parameterizedString></step></steps>',
2938
+ },
2939
+ { key: 'System.Description', value: '<p>Snapshot description</p>' },
2940
+ ],
2941
+ },
2942
+ },
2943
+ ],
2944
+ },
2945
+ ]);
2946
+ jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([
2947
+ {
2948
+ workItemId: 9777,
2949
+ requirementId: 'SR7777',
2950
+ baseKey: 'SR7777',
2951
+ title: 'Req 7777',
2952
+ responsibility: 'ESUK',
2953
+ linkedTestCaseIds: [777],
2954
+ areaPath: 'MEWP\\Customer Requirements\\Level 2',
2955
+ },
2956
+ ]);
2957
+ jest.spyOn(resultDataProvider, 'buildLinkedRequirementsByTestCase').mockResolvedValueOnce(new Map([
2958
+ [
2959
+ 777,
2960
+ {
2961
+ baseKeys: new Set(['SR7777']),
2962
+ fullCodes: new Set(['SR7777']),
2963
+ },
2964
+ ],
2965
+ ]));
2966
+ const fetchWorkItemsByIdsSpy = jest
2967
+ .spyOn(resultDataProvider, 'fetchWorkItemsByIds')
2968
+ .mockResolvedValueOnce([
2969
+ {
2970
+ id: 777,
2971
+ fields: {
2972
+ 'System.Title': 'TC 777 (latest title)',
2973
+ 'System.Description': '<p><b><u>Trial specific assumptions, constraints, dependencies and requirements</u></b></p><p>SR7777</p>',
2974
+ 'Microsoft.VSTS.TCM.Steps': '<steps><step id="2" type="ActionStep"><parameterizedString isformatted="true">Action</parameterizedString><parameterizedString isformatted="true">SR7777</parameterizedString></step></steps>',
2975
+ },
2976
+ },
2977
+ ]);
2978
+ jest.spyOn(resultDataProvider.testStepParserHelper, 'parseTestSteps').mockImplementation(async (...args) => [
2979
+ {
2980
+ stepId: '1',
2981
+ stepPosition: '1',
2982
+ action: 'Action',
2983
+ expected: String((args === null || args === void 0 ? void 0 : args[0]) || '').includes('SR7777') ? 'SR7777' : 'SR0001',
2984
+ isSharedStepTitle: false,
2985
+ },
2986
+ ]);
2987
+ const result = await resultDataProvider.getMewpInternalValidationFlatResults('123', mockProjectName, [1]);
2988
+ expect(fetchWorkItemsByIdsSpy).toHaveBeenCalledWith(mockProjectName, [777], false);
2989
+ expect(resultDataProvider.testStepParserHelper.parseTestSteps).toHaveBeenCalledWith(expect.stringContaining('SR7777'), expect.any(Map));
2990
+ expect(result.rows).toHaveLength(1);
2991
+ expect(result.rows[0]).toEqual(expect.objectContaining({
2992
+ 'Test Case ID': 777,
2993
+ 'Test Case Title': 'TC 777 (latest title)',
2994
+ 'Mentioned but Not Linked': '',
2995
+ 'Linked but Not Mentioned': '',
2996
+ 'Validation Status': 'Pass',
2997
+ }));
2998
+ });
2924
2999
  });
2925
3000
  describe('buildLinkedRequirementsByTestCase', () => {
2926
3001
  it('should map linked requirements only for supported test-case requirement relation types', async () => {