@elisra-devops/docgen-data-provider 1.27.0 → 1.29.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/tfs-data.d.ts +6 -0
- package/bin/models/tfs-data.js.map +1 -1
- package/bin/modules/ResultDataProvider.d.ts +13 -2
- package/bin/modules/ResultDataProvider.js +140 -25
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/modules/TestDataProvider.js +3 -2
- package/bin/modules/TestDataProvider.js.map +1 -1
- package/bin/modules/TicketsDataProvider.d.ts +40 -5
- package/bin/modules/TicketsDataProvider.js +67 -19
- package/bin/modules/TicketsDataProvider.js.map +1 -1
- package/bin/modules/test/ResultDataProvider.test.js +67 -101
- package/bin/modules/test/ResultDataProvider.test.js.map +1 -1
- package/bin/modules/test/testDataProvider.test.js +13 -15
- package/bin/modules/test/testDataProvider.test.js.map +1 -1
- package/bin/utils/DataProviderUtils.d.ts +11 -0
- package/bin/utils/DataProviderUtils.js +21 -0
- package/bin/utils/DataProviderUtils.js.map +1 -0
- package/package.json +1 -1
- package/src/models/tfs-data.ts +7 -0
- package/src/modules/ResultDataProvider.ts +193 -43
- package/src/modules/TestDataProvider.ts +10 -5
- package/src/modules/TicketsDataProvider.ts +86 -25
- package/src/modules/test/ResultDataProvider.test.ts +511 -550
- package/src/modules/test/testDataProvider.test.ts +19 -18
- package/src/utils/DataProviderUtils.ts +16 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TFSServices } from '../../helpers/tfs';
|
|
2
2
|
import { Helper, suiteData } from '../../helpers/helper';
|
|
3
3
|
import TestDataProvider from '../TestDataProvider';
|
|
4
|
-
import
|
|
4
|
+
import Utils from '../../utils/testStepParserHelper';
|
|
5
5
|
import logger from '../../utils/logger';
|
|
6
6
|
import { TestCase } from '../../models/tfs-data';
|
|
7
7
|
|
|
@@ -41,7 +41,7 @@ describe('TestDataProvider', () => {
|
|
|
41
41
|
const cache = new Map();
|
|
42
42
|
cache.set(mockUrl, {
|
|
43
43
|
data: mockData,
|
|
44
|
-
timestamp: Date.now()
|
|
44
|
+
timestamp: Date.now(),
|
|
45
45
|
});
|
|
46
46
|
(testDataProvider as any).cache = cache;
|
|
47
47
|
|
|
@@ -61,7 +61,7 @@ describe('TestDataProvider', () => {
|
|
|
61
61
|
const cache = new Map();
|
|
62
62
|
cache.set(mockUrl, {
|
|
63
63
|
data: mockData,
|
|
64
|
-
timestamp: Date.now() - 70000 // Expired (default TTL is 60000ms)
|
|
64
|
+
timestamp: Date.now() - 70000, // Expired (default TTL is 60000ms)
|
|
65
65
|
});
|
|
66
66
|
(testDataProvider as any).cache = cache;
|
|
67
67
|
|
|
@@ -127,8 +127,8 @@ describe('TestDataProvider', () => {
|
|
|
127
127
|
const mockData = {
|
|
128
128
|
value: [
|
|
129
129
|
{ id: '456', name: 'Test Plan 1' },
|
|
130
|
-
{ id: '789', name: 'Test Plan 2' }
|
|
131
|
-
]
|
|
130
|
+
{ id: '789', name: 'Test Plan 2' },
|
|
131
|
+
],
|
|
132
132
|
};
|
|
133
133
|
(TFSServices.getItemContent as jest.Mock).mockResolvedValueOnce(mockData);
|
|
134
134
|
|
|
@@ -150,8 +150,8 @@ describe('TestDataProvider', () => {
|
|
|
150
150
|
const mockData = {
|
|
151
151
|
value: [
|
|
152
152
|
{ id: '123', name: 'Test Suite 1' },
|
|
153
|
-
{ id: '456', name: 'Test Suite 2' }
|
|
154
|
-
]
|
|
153
|
+
{ id: '456', name: 'Test Suite 2' },
|
|
154
|
+
],
|
|
155
155
|
};
|
|
156
156
|
(TFSServices.getItemContent as jest.Mock).mockResolvedValueOnce(mockData);
|
|
157
157
|
|
|
@@ -182,14 +182,16 @@ describe('TestDataProvider', () => {
|
|
|
182
182
|
describe('GetTestSuitesForPlan', () => {
|
|
183
183
|
it('should throw error when project is not provided', async () => {
|
|
184
184
|
// Act & Assert
|
|
185
|
-
await expect(testDataProvider.GetTestSuitesForPlan('', mockPlanId))
|
|
186
|
-
|
|
185
|
+
await expect(testDataProvider.GetTestSuitesForPlan('', mockPlanId)).rejects.toThrow(
|
|
186
|
+
'Project not selected'
|
|
187
|
+
);
|
|
187
188
|
});
|
|
188
189
|
|
|
189
190
|
it('should throw error when plan ID is not provided', async () => {
|
|
190
191
|
// Act & Assert
|
|
191
|
-
await expect(testDataProvider.GetTestSuitesForPlan(mockProject, ''))
|
|
192
|
-
|
|
192
|
+
await expect(testDataProvider.GetTestSuitesForPlan(mockProject, '')).rejects.toThrow(
|
|
193
|
+
'Plan not selected'
|
|
194
|
+
);
|
|
193
195
|
});
|
|
194
196
|
|
|
195
197
|
it('should return test suites for a plan', async () => {
|
|
@@ -197,8 +199,8 @@ describe('TestDataProvider', () => {
|
|
|
197
199
|
const mockData = {
|
|
198
200
|
testSuites: [
|
|
199
201
|
{ id: '123', name: 'Test Suite 1' },
|
|
200
|
-
{ id: '456', name: 'Test Suite 2' }
|
|
201
|
-
]
|
|
202
|
+
{ id: '456', name: 'Test Suite 2' },
|
|
203
|
+
],
|
|
202
204
|
};
|
|
203
205
|
(TFSServices.getItemContent as jest.Mock).mockResolvedValueOnce(mockData);
|
|
204
206
|
|
|
@@ -251,8 +253,8 @@ describe('TestDataProvider', () => {
|
|
|
251
253
|
count: 2,
|
|
252
254
|
value: [
|
|
253
255
|
{ testCase: { id: '101', name: 'Test Case 1', url: 'url1' } },
|
|
254
|
-
{ testCase: { id: '102', name: 'Test Case 2', url: 'url2' } }
|
|
255
|
-
]
|
|
256
|
+
{ testCase: { id: '102', name: 'Test Case 2', url: 'url2' } },
|
|
257
|
+
],
|
|
256
258
|
};
|
|
257
259
|
(TFSServices.getItemContent as jest.Mock).mockResolvedValueOnce(mockData);
|
|
258
260
|
|
|
@@ -279,7 +281,7 @@ describe('TestDataProvider', () => {
|
|
|
279
281
|
const cache = new Map();
|
|
280
282
|
cache.set(mockUrl, {
|
|
281
283
|
data: mockData,
|
|
282
|
-
timestamp: Date.now()
|
|
284
|
+
timestamp: Date.now(),
|
|
283
285
|
});
|
|
284
286
|
(testDataProvider as any).cache = cache;
|
|
285
287
|
|
|
@@ -316,5 +318,4 @@ describe('TestDataProvider', () => {
|
|
|
316
318
|
expect(logger.info).toHaveBeenCalledWith(`Update runId : ${mockRunId} to state : ${mockState}`);
|
|
317
319
|
});
|
|
318
320
|
});
|
|
319
|
-
|
|
320
|
-
});
|
|
321
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default class DataProviderUtils {
|
|
2
|
+
/**
|
|
3
|
+
* Adds a value to an array stored in a Map. If the key doesn't exist,
|
|
4
|
+
* it initializes a new array for that key.
|
|
5
|
+
*
|
|
6
|
+
* @param map The Map to add to
|
|
7
|
+
* @param key The key for the array
|
|
8
|
+
* @param value The value to add to the array
|
|
9
|
+
*/
|
|
10
|
+
public static addToTraceMap(map: Map<string, string[]>, key: string, value: string): void {
|
|
11
|
+
if (!map.has(key)) {
|
|
12
|
+
map.set(key, []);
|
|
13
|
+
}
|
|
14
|
+
map.get(key)?.push(value);
|
|
15
|
+
}
|
|
16
|
+
}
|