@elisra-devops/docgen-data-provider 1.96.0 → 1.97.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elisra-devops/docgen-data-provider",
3
- "version": "1.96.0",
3
+ "version": "1.97.0",
4
4
  "description": "A document generator data provider, aimed to retrive data from azure devops",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4499,15 +4499,30 @@ export default class ResultDataProvider {
4499
4499
  includeNotRunTestCases: boolean
4500
4500
  ): Record<string, any> {
4501
4501
  return iterations.reduce((map, iterationItem) => {
4502
- if (
4503
- (isTestReporter && iterationItem.lastRunId && iterationItem.lastResultId) ||
4504
- iterationItem.iteration
4505
- ) {
4502
+ const hasRunIdentifiers =
4503
+ iterationItem?.lastRunId !== undefined &&
4504
+ iterationItem?.lastRunId !== null &&
4505
+ String(iterationItem?.lastRunId).trim() !== '' &&
4506
+ iterationItem?.lastResultId !== undefined &&
4507
+ iterationItem?.lastResultId !== null &&
4508
+ String(iterationItem?.lastResultId).trim() !== '';
4509
+
4510
+ if (hasRunIdentifiers) {
4506
4511
  const key = `${iterationItem.lastRunId}-${iterationItem.lastResultId}-${iterationItem.testCaseId}`;
4507
4512
  map[key] = iterationItem;
4508
4513
  } else if (includeNotRunTestCases) {
4509
4514
  const key = `${iterationItem.testCaseId}`;
4510
4515
  map[key] = iterationItem;
4516
+ if (isTestReporter && iterationItem?.iteration) {
4517
+ logger.debug(
4518
+ `[RunlessResolver] createIterationsMap: mapped runless testCaseId=${String(
4519
+ iterationItem?.testCaseId
4520
+ )} to case-only key`
4521
+ );
4522
+ }
4523
+ } else if (iterationItem?.iteration && !isTestReporter) {
4524
+ const key = `${iterationItem.lastRunId}-${iterationItem.lastResultId}-${iterationItem.testCaseId}`;
4525
+ map[key] = iterationItem;
4511
4526
  }
4512
4527
  return map;
4513
4528
  }, {} as Record<string, any>);
@@ -5128,6 +5128,17 @@ describe('ResultDataProvider', () => {
5128
5128
  // Assert
5129
5129
  expect(result['1']).toBeDefined();
5130
5130
  });
5131
+
5132
+ it('should map runless test reporter item with iteration by testCaseId key', () => {
5133
+ const iterations = [
5134
+ { testCaseId: 217897, lastRunId: undefined, lastResultId: undefined, iteration: { actionResults: [] } },
5135
+ ];
5136
+
5137
+ const result = (resultDataProvider as any).createIterationsMap(iterations, true, true);
5138
+
5139
+ expect(result['217897']).toBeDefined();
5140
+ expect(result['undefined-undefined-217897']).toBeUndefined();
5141
+ });
5131
5142
  });
5132
5143
 
5133
5144
  describe('alignStepsWithIterationsBase', () => {