@elisra-devops/docgen-data-provider 1.136.3 → 1.136.4
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.js +4 -1
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +69 -0
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/modules/ResultDataProvider.ts +6 -1
- package/src/tests/modules/ResultDataProvider.test.ts +115 -0
|
@@ -3590,6 +3590,20 @@ describe('ResultDataProvider', () => {
|
|
|
3590
3590
|
}, ['testCaseResult@runResultField'], false);
|
|
3591
3591
|
expect(res.testCaseResult).toEqual(expect.objectContaining({ url: '' }));
|
|
3592
3592
|
});
|
|
3593
|
+
it('should pass latest test case properties flag to the point result fetch', async () => {
|
|
3594
|
+
const fetchResultDataBaseSpy = jest
|
|
3595
|
+
.spyOn(resultDataProvider, 'fetchResultDataBase')
|
|
3596
|
+
.mockResolvedValue({});
|
|
3597
|
+
await resultDataProvider.fetchResultDataForTestReporter(mockProjectName, 'suite1', { lastRunId: 456, lastResultId: 789, testCaseId: 123 }, ['Custom.SortIndex@testCaseWorkItemField'], false, false, false, true);
|
|
3598
|
+
expect(fetchResultDataBaseSpy.mock.calls[0][5]).toEqual([
|
|
3599
|
+
['Custom.SortIndex@testCaseWorkItemField'],
|
|
3600
|
+
false,
|
|
3601
|
+
{ lastRunId: 456, lastResultId: 789, testCaseId: 123 },
|
|
3602
|
+
false,
|
|
3603
|
+
false,
|
|
3604
|
+
true,
|
|
3605
|
+
]);
|
|
3606
|
+
});
|
|
3593
3607
|
});
|
|
3594
3608
|
describe('fetchResultDataBasedOnWiBase', () => {
|
|
3595
3609
|
it('should return null and warn when runId/resultId are 0 and no point is provided', async () => {
|
|
@@ -3626,6 +3640,61 @@ describe('ResultDataProvider', () => {
|
|
|
3626
3640
|
filteredFields: { 'System.Title': 'Title 123' },
|
|
3627
3641
|
}));
|
|
3628
3642
|
});
|
|
3643
|
+
it('should use latest test case fields for executed points when latest properties mode is enabled', async () => {
|
|
3644
|
+
const point = {
|
|
3645
|
+
testCaseId: '123',
|
|
3646
|
+
testCaseName: 'TC 123',
|
|
3647
|
+
outcome: 'passed',
|
|
3648
|
+
lastRunId: 456,
|
|
3649
|
+
lastResultId: 789,
|
|
3650
|
+
testSuite: { id: '1', name: 'Suite' },
|
|
3651
|
+
};
|
|
3652
|
+
tfs_1.TFSServices.getItemContent.mockResolvedValueOnce({
|
|
3653
|
+
id: 123,
|
|
3654
|
+
rev: 10,
|
|
3655
|
+
fields: {
|
|
3656
|
+
'System.State': 'Active',
|
|
3657
|
+
'System.CreatedDate': '2024-01-01T00:00:00',
|
|
3658
|
+
'Microsoft.VSTS.TCM.Priority': 1,
|
|
3659
|
+
'Custom.SortIndex': 3,
|
|
3660
|
+
'Microsoft.VSTS.TCM.Steps': '<steps></steps>',
|
|
3661
|
+
},
|
|
3662
|
+
relations: null,
|
|
3663
|
+
});
|
|
3664
|
+
const selectedFields = ['Custom.SortIndex@testCaseWorkItemField'];
|
|
3665
|
+
const res = await resultDataProvider.fetchResultDataBasedOnWiBase(mockProjectName, '456', '789', true, selectedFields, false, point, false, false, true);
|
|
3666
|
+
const calledUrls = tfs_1.TFSServices.getItemContent.mock.calls.map((args) => String(args[0]));
|
|
3667
|
+
expect(calledUrls.some((url) => url.includes('/_apis/test/runs/456/results/789'))).toBe(false);
|
|
3668
|
+
expect(calledUrls.some((url) => url.includes('/_apis/wit/workItems/123?$expand=all'))).toBe(true);
|
|
3669
|
+
expect(res).toEqual(expect.objectContaining({
|
|
3670
|
+
testCaseRevision: 10,
|
|
3671
|
+
filteredFields: { 'Custom.SortIndex': 3 },
|
|
3672
|
+
}));
|
|
3673
|
+
});
|
|
3674
|
+
it('should log latest properties mode when bypassing run revision data', async () => {
|
|
3675
|
+
const point = {
|
|
3676
|
+
testCaseId: '123',
|
|
3677
|
+
testCaseName: 'TC 123',
|
|
3678
|
+
outcome: 'passed',
|
|
3679
|
+
lastRunId: 456,
|
|
3680
|
+
lastResultId: 789,
|
|
3681
|
+
testSuite: { id: '1', name: 'Suite' },
|
|
3682
|
+
};
|
|
3683
|
+
tfs_1.TFSServices.getItemContent.mockResolvedValueOnce({
|
|
3684
|
+
id: 123,
|
|
3685
|
+
rev: 10,
|
|
3686
|
+
fields: {
|
|
3687
|
+
'System.State': 'Active',
|
|
3688
|
+
'System.CreatedDate': '2024-01-01T00:00:00',
|
|
3689
|
+
'Microsoft.VSTS.TCM.Priority': 1,
|
|
3690
|
+
'Custom.SortIndex': 3,
|
|
3691
|
+
'Microsoft.VSTS.TCM.Steps': '<steps></steps>',
|
|
3692
|
+
},
|
|
3693
|
+
relations: null,
|
|
3694
|
+
});
|
|
3695
|
+
await resultDataProvider.fetchResultDataBasedOnWiBase(mockProjectName, '456', '789', true, ['Custom.SortIndex@testCaseWorkItemField'], false, point, false, false, true);
|
|
3696
|
+
expect(logger_1.default.debug).toHaveBeenCalledWith(expect.stringContaining('[TestReporter][LatestProperties] Fetching latest test case work item'));
|
|
3697
|
+
});
|
|
3629
3698
|
it('should fetch no-run test case by suite test-case revision when provided', async () => {
|
|
3630
3699
|
const point = {
|
|
3631
3700
|
testCaseId: '123',
|