@elisra-devops/docgen-data-provider 1.98.0 → 1.100.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.
@@ -4132,7 +4132,7 @@ describe('ResultDataProvider', () => {
4132
4132
  // Assert
4133
4133
  expect(result['1']).toBeDefined();
4134
4134
  });
4135
- it('should map runless test reporter item with iteration by testCaseId key', () => {
4135
+ it('should map runless test reporter item with iteration by testCaseId key when point id is missing', () => {
4136
4136
  const iterations = [
4137
4137
  { testCaseId: 217897, lastRunId: undefined, lastResultId: undefined, iteration: { actionResults: [] } },
4138
4138
  ];
@@ -4140,6 +4140,34 @@ describe('ResultDataProvider', () => {
4140
4140
  expect(result['217897']).toBeDefined();
4141
4141
  expect(result['undefined-undefined-217897']).toBeUndefined();
4142
4142
  });
4143
+ it('should map runless test reporter item with iteration by point-aware key when point id exists', () => {
4144
+ const iterations = [
4145
+ {
4146
+ testCaseId: 217916,
4147
+ testPointId: 1001,
4148
+ lastRunId: undefined,
4149
+ lastResultId: undefined,
4150
+ iteration: { actionResults: [] },
4151
+ },
4152
+ ];
4153
+ const result = resultDataProvider.createIterationsMap(iterations, true, true);
4154
+ expect(result['point-1001-217916']).toBeDefined();
4155
+ expect(result['217916']).toBeUndefined();
4156
+ });
4157
+ it('should map runless test reporter item with iteration by revision key when point id is missing', () => {
4158
+ const iterations = [
4159
+ {
4160
+ testCaseId: 217916,
4161
+ testCaseRevision: 18,
4162
+ lastRunId: undefined,
4163
+ lastResultId: undefined,
4164
+ iteration: { actionResults: [] },
4165
+ },
4166
+ ];
4167
+ const result = resultDataProvider.createIterationsMap(iterations, true, true);
4168
+ expect(result['rev-217916-18']).toBeDefined();
4169
+ expect(result['217916']).toBeUndefined();
4170
+ });
4143
4171
  });
4144
4172
  describe('alignStepsWithIterationsBase', () => {
4145
4173
  it('should return empty array when no iterations', () => {
@@ -4828,6 +4856,201 @@ describe('ResultDataProvider', () => {
4828
4856
  expect(res).toHaveLength(1);
4829
4857
  expect(res[0].stepNo).toBeUndefined();
4830
4858
  });
4859
+ it('should keep runless step rows even when suite testCasesItems entry is missing', () => {
4860
+ const testData = [
4861
+ {
4862
+ testGroupName: 'G',
4863
+ testPointsItems: [{ testCaseId: 217916, testPointId: 1001, testCaseName: 'TC 217916', testCaseUrl: 'u' }],
4864
+ testCasesItems: [],
4865
+ },
4866
+ ];
4867
+ const iterations = [
4868
+ {
4869
+ testCaseId: 217916,
4870
+ testPointId: 1001,
4871
+ lastRunId: undefined,
4872
+ lastResultId: undefined,
4873
+ iteration: {
4874
+ actionResults: [
4875
+ {
4876
+ stepIdentifier: '16',
4877
+ stepPosition: '1',
4878
+ action: 'A',
4879
+ expected: 'E',
4880
+ outcome: 'Unspecified',
4881
+ isSharedStepTitle: false,
4882
+ errorMessage: '',
4883
+ },
4884
+ ],
4885
+ },
4886
+ testCaseResult: 'Not Run',
4887
+ comment: '',
4888
+ runBy: { displayName: 'u' },
4889
+ failureType: '',
4890
+ executionDate: '',
4891
+ configurationName: '',
4892
+ relatedRequirements: [],
4893
+ relatedBugs: [],
4894
+ relatedCRs: [],
4895
+ customFields: {},
4896
+ },
4897
+ ];
4898
+ const res = resultDataProvider.alignStepsWithIterationsTestReporter(testData, iterations, ['includeSteps@stepsRunProperties', 'stepRunStatus@stepsRunProperties'], true);
4899
+ expect(res).toHaveLength(1);
4900
+ expect(res[0]).toEqual(expect.objectContaining({ stepNo: '1', stepStatus: 'Not Run' }));
4901
+ });
4902
+ it('should match runless iterations by testPointId when the same testCase appears in multiple suites', () => {
4903
+ const testData = [
4904
+ {
4905
+ testGroupName: 'Suite A',
4906
+ testPointsItems: [{ testCaseId: 217916, testPointId: 2001, testCaseName: 'TC', testCaseUrl: 'u1' }],
4907
+ testCasesItems: [],
4908
+ },
4909
+ {
4910
+ testGroupName: 'Suite B',
4911
+ testPointsItems: [{ testCaseId: 217916, testPointId: 2002, testCaseName: 'TC', testCaseUrl: 'u2' }],
4912
+ testCasesItems: [],
4913
+ },
4914
+ ];
4915
+ const iterations = [
4916
+ {
4917
+ testCaseId: 217916,
4918
+ testPointId: 2001,
4919
+ lastRunId: undefined,
4920
+ lastResultId: undefined,
4921
+ iteration: {
4922
+ actionResults: [
4923
+ {
4924
+ stepIdentifier: '16',
4925
+ stepPosition: '1',
4926
+ action: 'A',
4927
+ expected: 'E',
4928
+ outcome: 'Unspecified',
4929
+ isSharedStepTitle: false,
4930
+ errorMessage: '',
4931
+ },
4932
+ ],
4933
+ },
4934
+ testCaseResult: 'Not Run',
4935
+ comment: '',
4936
+ runBy: { displayName: 'u' },
4937
+ failureType: '',
4938
+ executionDate: '',
4939
+ configurationName: '',
4940
+ relatedRequirements: [],
4941
+ relatedBugs: [],
4942
+ relatedCRs: [],
4943
+ customFields: {},
4944
+ },
4945
+ {
4946
+ testCaseId: 217916,
4947
+ testPointId: 2002,
4948
+ lastRunId: undefined,
4949
+ lastResultId: undefined,
4950
+ iteration: { actionResults: [] },
4951
+ testCaseResult: 'Not Run',
4952
+ comment: '',
4953
+ runBy: { displayName: 'u' },
4954
+ failureType: '',
4955
+ executionDate: '',
4956
+ configurationName: '',
4957
+ relatedRequirements: [],
4958
+ relatedBugs: [],
4959
+ relatedCRs: [],
4960
+ customFields: {},
4961
+ },
4962
+ ];
4963
+ const res = resultDataProvider.alignStepsWithIterationsTestReporter(testData, iterations, ['includeSteps@stepsRunProperties', 'stepRunStatus@stepsRunProperties'], true);
4964
+ expect(res).toHaveLength(2);
4965
+ const suiteA = res.find((row) => (row === null || row === void 0 ? void 0 : row.suiteName) === 'Suite A');
4966
+ const suiteB = res.find((row) => (row === null || row === void 0 ? void 0 : row.suiteName) === 'Suite B');
4967
+ expect(suiteA).toEqual(expect.objectContaining({ stepNo: '1', stepStatus: 'Not Run' }));
4968
+ expect(suiteB).toBeDefined();
4969
+ expect(Object.prototype.hasOwnProperty.call(suiteB, 'stepNo')).toBe(false);
4970
+ });
4971
+ it('should match runless iterations by revision when point id is missing and same testCase appears in multiple suites', () => {
4972
+ const testData = [
4973
+ {
4974
+ testGroupName: 'Suite A',
4975
+ testPointsItems: [{ testCaseId: 217916, testCaseName: 'TC', testCaseUrl: 'u1' }],
4976
+ testCasesItems: [
4977
+ {
4978
+ workItem: {
4979
+ id: 217916,
4980
+ workItemFields: [{ key: 'System.Rev', value: 18 }],
4981
+ },
4982
+ },
4983
+ ],
4984
+ },
4985
+ {
4986
+ testGroupName: 'Suite B',
4987
+ testPointsItems: [{ testCaseId: 217916, testCaseName: 'TC', testCaseUrl: 'u2' }],
4988
+ testCasesItems: [
4989
+ {
4990
+ workItem: {
4991
+ id: 217916,
4992
+ workItemFields: [{ key: 'System.Rev', value: 23 }],
4993
+ },
4994
+ },
4995
+ ],
4996
+ },
4997
+ ];
4998
+ const iterations = [
4999
+ {
5000
+ testCaseId: 217916,
5001
+ testCaseRevision: 18,
5002
+ lastRunId: undefined,
5003
+ lastResultId: undefined,
5004
+ iteration: {
5005
+ actionResults: [
5006
+ {
5007
+ stepIdentifier: '16',
5008
+ stepPosition: '1',
5009
+ action: 'A',
5010
+ expected: 'E',
5011
+ outcome: 'Unspecified',
5012
+ isSharedStepTitle: false,
5013
+ errorMessage: '',
5014
+ },
5015
+ ],
5016
+ },
5017
+ testCaseResult: 'Not Run',
5018
+ comment: '',
5019
+ runBy: { displayName: 'u' },
5020
+ failureType: '',
5021
+ executionDate: '',
5022
+ configurationName: '',
5023
+ relatedRequirements: [],
5024
+ relatedBugs: [],
5025
+ relatedCRs: [],
5026
+ customFields: {},
5027
+ },
5028
+ {
5029
+ testCaseId: 217916,
5030
+ testCaseRevision: 23,
5031
+ lastRunId: undefined,
5032
+ lastResultId: undefined,
5033
+ iteration: { actionResults: [] },
5034
+ testCaseResult: 'Not Run',
5035
+ comment: '',
5036
+ runBy: { displayName: 'u' },
5037
+ failureType: '',
5038
+ executionDate: '',
5039
+ configurationName: '',
5040
+ relatedRequirements: [],
5041
+ relatedBugs: [],
5042
+ relatedCRs: [],
5043
+ customFields: {},
5044
+ },
5045
+ ];
5046
+ const res = resultDataProvider.alignStepsWithIterationsTestReporter(testData, iterations, ['includeSteps@stepsRunProperties', 'stepRunStatus@stepsRunProperties'], true);
5047
+ expect(res).toHaveLength(2);
5048
+ const suiteA = res.find((row) => (row === null || row === void 0 ? void 0 : row.suiteName) === 'Suite A');
5049
+ const suiteB = res.find((row) => (row === null || row === void 0 ? void 0 : row.suiteName) === 'Suite B');
5050
+ expect(suiteA).toEqual(expect.objectContaining({ stepNo: '1', stepStatus: 'Not Run' }));
5051
+ expect(suiteB).toBeDefined();
5052
+ expect(Object.prototype.hasOwnProperty.call(suiteB, 'stepNo')).toBe(false);
5053
+ });
4831
5054
  });
4832
5055
  describe('fetchOpenPcrData', () => {
4833
5056
  it('should populate both trace maps using linked work items', async () => {