@elisra-devops/docgen-data-provider 1.95.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/bin/modules/ResultDataProvider.d.ts +5 -0
- package/bin/modules/ResultDataProvider.js +63 -9
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +56 -0
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/ResultDataProvider.ts +81 -8
- package/src/tests/modules/ResultDataProvider.test.ts +75 -0
|
@@ -3316,6 +3316,54 @@ describe('ResultDataProvider', () => {
|
|
|
3316
3316
|
expect(calledUrls.some((url) => url.includes('/revisions/9'))).toBe(false);
|
|
3317
3317
|
expect(res).toEqual(expect.objectContaining({ testCaseRevision: 6 }));
|
|
3318
3318
|
});
|
|
3319
|
+
it('should fallback from asOf snapshot without steps to revision snapshot with steps', async () => {
|
|
3320
|
+
tfs_1.TFSServices.getItemContent.mockReset();
|
|
3321
|
+
const point = {
|
|
3322
|
+
testCaseId: '777',
|
|
3323
|
+
testCaseName: 'TC 777',
|
|
3324
|
+
outcome: 'Not Run',
|
|
3325
|
+
pointAsOfTimestamp: '2025-03-01T00:00:00Z',
|
|
3326
|
+
suiteTestCase: {
|
|
3327
|
+
workItem: {
|
|
3328
|
+
id: 777,
|
|
3329
|
+
workItemFields: [{ key: 'System.Rev', value: '21' }],
|
|
3330
|
+
},
|
|
3331
|
+
},
|
|
3332
|
+
testSuite: { id: '1', name: 'Suite' },
|
|
3333
|
+
};
|
|
3334
|
+
tfs_1.TFSServices.getItemContent
|
|
3335
|
+
.mockResolvedValueOnce({
|
|
3336
|
+
id: 777,
|
|
3337
|
+
rev: 18,
|
|
3338
|
+
fields: {
|
|
3339
|
+
'System.State': 'Design',
|
|
3340
|
+
'System.CreatedDate': '2024-01-01T00:00:00',
|
|
3341
|
+
'Microsoft.VSTS.TCM.Priority': 1,
|
|
3342
|
+
'System.Title': 'TC 777',
|
|
3343
|
+
},
|
|
3344
|
+
relations: [],
|
|
3345
|
+
})
|
|
3346
|
+
.mockResolvedValueOnce({
|
|
3347
|
+
id: 777,
|
|
3348
|
+
rev: 21,
|
|
3349
|
+
fields: {
|
|
3350
|
+
'System.State': 'Design',
|
|
3351
|
+
'System.CreatedDate': '2024-01-01T00:00:00',
|
|
3352
|
+
'Microsoft.VSTS.TCM.Priority': 1,
|
|
3353
|
+
'System.Title': 'TC 777',
|
|
3354
|
+
'Microsoft.VSTS.TCM.Steps': '<steps></steps>',
|
|
3355
|
+
},
|
|
3356
|
+
relations: [],
|
|
3357
|
+
});
|
|
3358
|
+
const res = await resultDataProvider.fetchResultDataBasedOnWiBase(mockProjectName, '0', '0', true, [], false, point, false, true);
|
|
3359
|
+
const calledUrls = tfs_1.TFSServices.getItemContent.mock.calls.map((args) => String(args[0]));
|
|
3360
|
+
expect(calledUrls.some((url) => url.includes('/_apis/wit/workItems/777?asOf='))).toBe(true);
|
|
3361
|
+
expect(calledUrls.some((url) => url.includes('/_apis/wit/workItems/777/revisions/21'))).toBe(true);
|
|
3362
|
+
expect(res).toEqual(expect.objectContaining({
|
|
3363
|
+
testCaseRevision: 21,
|
|
3364
|
+
stepsResultXml: '<steps></steps>',
|
|
3365
|
+
}));
|
|
3366
|
+
});
|
|
3319
3367
|
it('should fallback to suite revision when asOf fetch fails', async () => {
|
|
3320
3368
|
tfs_1.TFSServices.getItemContent.mockReset();
|
|
3321
3369
|
const point = {
|
|
@@ -4084,6 +4132,14 @@ describe('ResultDataProvider', () => {
|
|
|
4084
4132
|
// Assert
|
|
4085
4133
|
expect(result['1']).toBeDefined();
|
|
4086
4134
|
});
|
|
4135
|
+
it('should map runless test reporter item with iteration by testCaseId key', () => {
|
|
4136
|
+
const iterations = [
|
|
4137
|
+
{ testCaseId: 217897, lastRunId: undefined, lastResultId: undefined, iteration: { actionResults: [] } },
|
|
4138
|
+
];
|
|
4139
|
+
const result = resultDataProvider.createIterationsMap(iterations, true, true);
|
|
4140
|
+
expect(result['217897']).toBeDefined();
|
|
4141
|
+
expect(result['undefined-undefined-217897']).toBeUndefined();
|
|
4142
|
+
});
|
|
4087
4143
|
});
|
|
4088
4144
|
describe('alignStepsWithIterationsBase', () => {
|
|
4089
4145
|
it('should return empty array when no iterations', () => {
|