@elisra-devops/docgen-data-provider 1.88.0 → 1.90.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/models/mewp-reporting.d.ts +0 -4
- package/bin/modules/ResultDataProvider.d.ts +8 -7
- package/bin/modules/ResultDataProvider.js +153 -234
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +50 -18
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/models/mewp-reporting.ts +0 -5
- package/src/modules/ResultDataProvider.ts +185 -254
- package/src/tests/modules/ResultDataProvider.test.ts +73 -19
|
@@ -865,6 +865,15 @@ describe('ResultDataProvider', () => {
|
|
|
865
865
|
});
|
|
866
866
|
});
|
|
867
867
|
describe('getMewpL2CoverageFlatResults', () => {
|
|
868
|
+
it('should fetch MEWP scoped test data from selected suites', async () => {
|
|
869
|
+
jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
|
|
870
|
+
const scopedSpy = jest
|
|
871
|
+
.spyOn(resultDataProvider, 'fetchMewpScopedTestData')
|
|
872
|
+
.mockResolvedValueOnce([]);
|
|
873
|
+
jest.spyOn(resultDataProvider, 'fetchMewpL2Requirements').mockResolvedValueOnce([]);
|
|
874
|
+
await resultDataProvider.getMewpL2CoverageFlatResults('123', mockProjectName, [1], undefined);
|
|
875
|
+
expect(scopedSpy).toHaveBeenCalledWith('123', mockProjectName, [1]);
|
|
876
|
+
});
|
|
868
877
|
it('should map SR ids from steps and output requirement-test-case coverage rows', async () => {
|
|
869
878
|
jest.spyOn(resultDataProvider, 'fetchTestPlanName').mockResolvedValueOnce('Plan A');
|
|
870
879
|
jest.spyOn(resultDataProvider, 'fetchTestSuites').mockResolvedValueOnce([{ testSuiteId: 1 }]);
|
|
@@ -2102,7 +2111,7 @@ describe('ResultDataProvider', () => {
|
|
|
2102
2111
|
expect(new Set(result.rows.map((row) => row['Test Case ID']))).toEqual(new Set([201, 202, 203]));
|
|
2103
2112
|
expect(byTestCase.get(201)).toEqual(expect.objectContaining({
|
|
2104
2113
|
'Test Case Title': 'TC 201 - Mixed discrepancies',
|
|
2105
|
-
'Mentioned but Not Linked': 'Step 1: SR0095-3
|
|
2114
|
+
'Mentioned but Not Linked': 'Step 1: SR0095-3\nSR0511: SR0511-1, SR0511-2',
|
|
2106
2115
|
'Linked but Not Mentioned': 'SR8888',
|
|
2107
2116
|
'Validation Status': 'Fail',
|
|
2108
2117
|
}));
|
|
@@ -2328,7 +2337,7 @@ describe('ResultDataProvider', () => {
|
|
|
2328
2337
|
'Test Case ID': 42,
|
|
2329
2338
|
'Test Case Title': 'TC-0042',
|
|
2330
2339
|
'Mentioned but Not Linked': 'Step 3: SR0027',
|
|
2331
|
-
'Linked but Not Mentioned': 'SR0817
|
|
2340
|
+
'Linked but Not Mentioned': 'SR0817\nSR0818\nSR0859',
|
|
2332
2341
|
'Validation Status': 'Fail',
|
|
2333
2342
|
}));
|
|
2334
2343
|
expect(String(result.rows[0]['Mentioned but Not Linked'] || '')).not.toContain('VVRM');
|
|
@@ -2492,16 +2501,12 @@ describe('ResultDataProvider', () => {
|
|
|
2492
2501
|
expect((_d = (_c = linked.get(1002)) === null || _c === void 0 ? void 0 : _c.fullCodes) === null || _d === void 0 ? void 0 : _d.has('SR0099-1')).toBe(false);
|
|
2493
2502
|
});
|
|
2494
2503
|
});
|
|
2495
|
-
describe('MEWP
|
|
2496
|
-
it('should
|
|
2504
|
+
describe('MEWP release snapshot scoping', () => {
|
|
2505
|
+
it('should scope only to selected suites and avoid cross-Rel fallback selection', async () => {
|
|
2497
2506
|
const suites = [
|
|
2498
2507
|
{ testSuiteId: 10, suiteName: 'Rel10 / Validation' },
|
|
2499
2508
|
{ testSuiteId: 11, suiteName: 'Rel11 / Validation' },
|
|
2500
2509
|
];
|
|
2501
|
-
const allSuites = [
|
|
2502
|
-
{ testSuiteId: 10, suiteName: 'Rel10 / Validation' },
|
|
2503
|
-
{ testSuiteId: 11, suiteName: 'Rel11 / Validation' },
|
|
2504
|
-
];
|
|
2505
2510
|
const rawTestData = [
|
|
2506
2511
|
{
|
|
2507
2512
|
suiteName: 'Rel10 / Validation',
|
|
@@ -2522,20 +2527,15 @@ describe('ResultDataProvider', () => {
|
|
|
2522
2527
|
];
|
|
2523
2528
|
const fetchSuitesSpy = jest
|
|
2524
2529
|
.spyOn(resultDataProvider, 'fetchTestSuites')
|
|
2525
|
-
.mockResolvedValueOnce(suites)
|
|
2526
|
-
.mockResolvedValueOnce(allSuites);
|
|
2530
|
+
.mockResolvedValueOnce(suites);
|
|
2527
2531
|
const fetchDataSpy = jest
|
|
2528
2532
|
.spyOn(resultDataProvider, 'fetchTestData')
|
|
2529
2533
|
.mockResolvedValueOnce(rawTestData);
|
|
2530
|
-
const scoped = await resultDataProvider.fetchMewpScopedTestData('123', mockProjectName, [11]
|
|
2531
|
-
expect(fetchSuitesSpy).toHaveBeenCalledTimes(
|
|
2534
|
+
const scoped = await resultDataProvider.fetchMewpScopedTestData('123', mockProjectName, [11]);
|
|
2535
|
+
expect(fetchSuitesSpy).toHaveBeenCalledTimes(1);
|
|
2536
|
+
expect(fetchSuitesSpy).toHaveBeenCalledWith('123', mockProjectName, [11], true);
|
|
2532
2537
|
expect(fetchDataSpy).toHaveBeenCalledTimes(1);
|
|
2533
|
-
expect(scoped).
|
|
2534
|
-
const selectedPoints = scoped[0].testPointsItems;
|
|
2535
|
-
const tc501 = selectedPoints.find((item) => item.testCaseId === 501);
|
|
2536
|
-
const tc502 = selectedPoints.find((item) => item.testCaseId === 502);
|
|
2537
|
-
expect(tc501).toEqual(expect.objectContaining({ lastRunId: 100, lastResultId: 200 }));
|
|
2538
|
-
expect(tc502).toEqual(expect.objectContaining({ lastRunId: 500, lastResultId: 600 }));
|
|
2538
|
+
expect(scoped).toEqual(rawTestData);
|
|
2539
2539
|
});
|
|
2540
2540
|
});
|
|
2541
2541
|
describe('MEWP external ingestion validation/parsing', () => {
|
|
@@ -3035,6 +3035,38 @@ describe('ResultDataProvider', () => {
|
|
|
3035
3035
|
filteredFields: { 'System.Title': 'Title 123' },
|
|
3036
3036
|
}));
|
|
3037
3037
|
});
|
|
3038
|
+
it('should fetch no-run test case by suite test-case revision when provided', async () => {
|
|
3039
|
+
const point = {
|
|
3040
|
+
testCaseId: '123',
|
|
3041
|
+
testCaseName: 'TC 123',
|
|
3042
|
+
outcome: 'passed',
|
|
3043
|
+
suiteTestCase: {
|
|
3044
|
+
workItem: {
|
|
3045
|
+
id: 123,
|
|
3046
|
+
rev: 9,
|
|
3047
|
+
workItemFields: [{ key: 'Microsoft.VSTS.TCM.Steps', value: '<steps></steps>' }],
|
|
3048
|
+
},
|
|
3049
|
+
},
|
|
3050
|
+
testSuite: { id: '1', name: 'Suite' },
|
|
3051
|
+
};
|
|
3052
|
+
tfs_1.TFSServices.getItemContent.mockResolvedValueOnce({
|
|
3053
|
+
id: 123,
|
|
3054
|
+
rev: 9,
|
|
3055
|
+
fields: {
|
|
3056
|
+
'System.State': 'Active',
|
|
3057
|
+
'System.CreatedDate': '2024-01-01T00:00:00',
|
|
3058
|
+
'Microsoft.VSTS.TCM.Priority': 1,
|
|
3059
|
+
'System.Title': 'Title 123',
|
|
3060
|
+
'Microsoft.VSTS.TCM.Steps': '<steps></steps>',
|
|
3061
|
+
},
|
|
3062
|
+
relations: null,
|
|
3063
|
+
});
|
|
3064
|
+
const res = await resultDataProvider.fetchResultDataBasedOnWiBase(mockProjectName, '0', '0', true, [], false, point);
|
|
3065
|
+
expect(tfs_1.TFSServices.getItemContent).toHaveBeenCalledWith(expect.stringContaining('/_apis/wit/workItems/123/revisions/9?$expand=all'), mockToken);
|
|
3066
|
+
const calledUrls = tfs_1.TFSServices.getItemContent.mock.calls.map((args) => String(args[0]));
|
|
3067
|
+
expect(calledUrls.some((url) => url.includes('?asOf='))).toBe(false);
|
|
3068
|
+
expect(res).toEqual(expect.objectContaining({ testCaseRevision: 9 }));
|
|
3069
|
+
});
|
|
3038
3070
|
it('should append linked relations and filter testCaseWorkItemField when isTestReporter=true and isQueryMode=false', async () => {
|
|
3039
3071
|
tfs_1.TFSServices.getItemContent.mockReset();
|
|
3040
3072
|
const selectedFields = ['associatedBug@linked', 'System.Title@testCaseWorkItemField'];
|