@elisra-devops/docgen-data-provider 1.69.3 → 1.69.5
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/ado-comments.d.ts +29 -0
- package/bin/models/ado-comments.js +3 -0
- package/bin/models/ado-comments.js.map +1 -0
- package/bin/modules/ResultDataProvider.d.ts +2 -0
- package/bin/modules/ResultDataProvider.js +80 -14
- package/bin/modules/ResultDataProvider.js.map +1 -1
- package/bin/tests/modules/ResultDataProvider.test.js +50 -34
- package/bin/tests/modules/ResultDataProvider.test.js.map +1 -1
- package/package.json +1 -1
- package/src/models/ado-comments.ts +33 -0
- package/src/modules/ResultDataProvider.ts +87 -9
- package/src/tests/modules/ResultDataProvider.test.ts +41 -21
|
@@ -1287,10 +1287,11 @@ describe('ResultDataProvider', () => {
|
|
|
1287
1287
|
});
|
|
1288
1288
|
|
|
1289
1289
|
it('should return only the most recent System.History entry by default', async () => {
|
|
1290
|
-
(TFSServices.
|
|
1290
|
+
(TFSServices.getItemContentWithHeaders as jest.Mock).mockReset();
|
|
1291
1291
|
|
|
1292
1292
|
const selectedFields = ['System.History@testCaseWorkItemField'];
|
|
1293
1293
|
|
|
1294
|
+
(TFSServices.getItemContent as jest.Mock).mockReset();
|
|
1294
1295
|
(TFSServices.getItemContent as jest.Mock)
|
|
1295
1296
|
// 1) run result
|
|
1296
1297
|
.mockResolvedValueOnce({
|
|
@@ -1305,22 +1306,30 @@ describe('ResultDataProvider', () => {
|
|
|
1305
1306
|
id: 123,
|
|
1306
1307
|
fields: { 'Microsoft.VSTS.TCM.Steps': '<steps></steps>' },
|
|
1307
1308
|
relations: [],
|
|
1308
|
-
})
|
|
1309
|
-
|
|
1310
|
-
|
|
1309
|
+
});
|
|
1310
|
+
|
|
1311
|
+
// 4) comments (new shape: { totalCount, count, comments })
|
|
1312
|
+
(TFSServices.getItemContentWithHeaders as jest.Mock).mockResolvedValueOnce({
|
|
1313
|
+
data: {
|
|
1314
|
+
totalCount: 2,
|
|
1315
|
+
count: 2,
|
|
1311
1316
|
comments: [
|
|
1312
|
-
{
|
|
1313
|
-
text: 'First comment',
|
|
1314
|
-
createdDate: '2024-01-01T00:00:00Z',
|
|
1315
|
-
createdBy: { displayName: 'Alice' },
|
|
1316
|
-
},
|
|
1317
1317
|
{
|
|
1318
1318
|
text: 'Second comment',
|
|
1319
1319
|
createdDate: '2024-01-02T00:00:00Z',
|
|
1320
1320
|
createdBy: { displayName: 'Bob' },
|
|
1321
|
+
isDeleted: false,
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
text: 'First comment',
|
|
1325
|
+
createdDate: '2024-01-01T00:00:00Z',
|
|
1326
|
+
createdBy: { displayName: 'Alice' },
|
|
1327
|
+
isDeleted: false,
|
|
1321
1328
|
},
|
|
1322
1329
|
],
|
|
1323
|
-
}
|
|
1330
|
+
},
|
|
1331
|
+
headers: {},
|
|
1332
|
+
});
|
|
1324
1333
|
|
|
1325
1334
|
const res = await (resultDataProvider as any).fetchResultDataBasedOnWiBase(
|
|
1326
1335
|
mockProjectName,
|
|
@@ -1338,6 +1347,7 @@ describe('ResultDataProvider', () => {
|
|
|
1338
1347
|
|
|
1339
1348
|
it('should backfill System.History from work item comments when requested (includeAllHistory=true)', async () => {
|
|
1340
1349
|
(TFSServices.getItemContent as jest.Mock).mockReset();
|
|
1350
|
+
(TFSServices.getItemContentWithHeaders as jest.Mock).mockReset();
|
|
1341
1351
|
|
|
1342
1352
|
const selectedFields = ['System.History@testCaseWorkItemField'];
|
|
1343
1353
|
|
|
@@ -1355,22 +1365,29 @@ describe('ResultDataProvider', () => {
|
|
|
1355
1365
|
id: 123,
|
|
1356
1366
|
fields: { 'Microsoft.VSTS.TCM.Steps': '<steps></steps>' },
|
|
1357
1367
|
relations: [],
|
|
1358
|
-
})
|
|
1359
|
-
|
|
1360
|
-
|
|
1368
|
+
});
|
|
1369
|
+
|
|
1370
|
+
(TFSServices.getItemContentWithHeaders as jest.Mock).mockResolvedValueOnce({
|
|
1371
|
+
data: {
|
|
1372
|
+
totalCount: 2,
|
|
1373
|
+
count: 2,
|
|
1361
1374
|
comments: [
|
|
1362
|
-
{
|
|
1363
|
-
text: 'First comment',
|
|
1364
|
-
createdDate: '2024-01-01T00:00:00Z',
|
|
1365
|
-
createdBy: { displayName: 'Alice' },
|
|
1366
|
-
},
|
|
1367
1375
|
{
|
|
1368
1376
|
text: 'Second comment',
|
|
1369
1377
|
createdDate: '2024-01-02T00:00:00Z',
|
|
1370
1378
|
createdBy: { displayName: 'Bob' },
|
|
1379
|
+
isDeleted: false,
|
|
1380
|
+
},
|
|
1381
|
+
{
|
|
1382
|
+
text: 'First comment',
|
|
1383
|
+
createdDate: '2024-01-01T00:00:00Z',
|
|
1384
|
+
createdBy: { displayName: 'Alice' },
|
|
1385
|
+
isDeleted: false,
|
|
1371
1386
|
},
|
|
1372
1387
|
],
|
|
1373
|
-
}
|
|
1388
|
+
},
|
|
1389
|
+
headers: {},
|
|
1390
|
+
});
|
|
1374
1391
|
|
|
1375
1392
|
const res = await (resultDataProvider as any).fetchResultDataBasedOnWiBase(
|
|
1376
1393
|
mockProjectName,
|
|
@@ -1391,6 +1408,7 @@ describe('ResultDataProvider', () => {
|
|
|
1391
1408
|
|
|
1392
1409
|
it('should return empty System.History when comments endpoint fails', async () => {
|
|
1393
1410
|
(TFSServices.getItemContent as jest.Mock).mockReset();
|
|
1411
|
+
(TFSServices.getItemContentWithHeaders as jest.Mock).mockReset();
|
|
1394
1412
|
|
|
1395
1413
|
const selectedFields = ['System.History@testCaseWorkItemField'];
|
|
1396
1414
|
|
|
@@ -1409,8 +1427,10 @@ describe('ResultDataProvider', () => {
|
|
|
1409
1427
|
fields: { 'Microsoft.VSTS.TCM.Steps': '<steps></steps>' },
|
|
1410
1428
|
relations: [],
|
|
1411
1429
|
})
|
|
1412
|
-
|
|
1413
|
-
|
|
1430
|
+
;
|
|
1431
|
+
|
|
1432
|
+
// 4) comments (fails)
|
|
1433
|
+
(TFSServices.getItemContentWithHeaders as jest.Mock).mockRejectedValueOnce(new Error('comments failed'));
|
|
1414
1434
|
|
|
1415
1435
|
const res = await (resultDataProvider as any).fetchResultDataBasedOnWiBase(
|
|
1416
1436
|
mockProjectName,
|