@forge/teamwork-graph 2.2.0-next.1 → 2.2.0-next.3
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/out/__test__/entity-operations.test.js +656 -81
- package/out/__test__/group-operations.test.js +30 -17
- package/out/__test__/user-operations.test.js +9 -2
- package/out/graph.d.ts.map +1 -1
- package/out/graph.js +35 -10
- package/out/types/objects/dashboard.d.ts +22 -0
- package/out/types/objects/dashboard.d.ts.map +1 -0
- package/out/types/objects/dashboard.js +2 -0
- package/out/types/objects/document.d.ts +1 -1
- package/out/types/objects/index.d.ts +7 -2
- package/out/types/objects/index.d.ts.map +1 -1
- package/out/types/objects/test-execution.d.ts +14 -0
- package/out/types/objects/test-execution.d.ts.map +1 -0
- package/out/types/objects/test-execution.js +2 -0
- package/out/types/objects/test-plan.d.ts +10 -0
- package/out/types/objects/test-plan.d.ts.map +1 -0
- package/out/types/objects/test-plan.js +2 -0
- package/out/types/objects/test-run.d.ts +27 -0
- package/out/types/objects/test-run.d.ts.map +1 -0
- package/out/types/objects/test-run.js +2 -0
- package/out/types/objects/test.d.ts +16 -0
- package/out/types/objects/test.d.ts.map +1 -0
- package/out/types/objects/test.js +2 -0
- package/out/types/requests.d.ts +77 -25
- package/out/types/requests.d.ts.map +1 -1
- package/out/utils/endpoints.d.ts +2 -2
- package/out/utils/endpoints.js +2 -2
- package/package.json +1 -1
|
@@ -43,7 +43,7 @@ describe('TeamWorkGraphClient - setObjects', () => {
|
|
|
43
43
|
],
|
|
44
44
|
'atlassian:document': {
|
|
45
45
|
type: {
|
|
46
|
-
category: '
|
|
46
|
+
category: 'DOCUMENT',
|
|
47
47
|
iconUrl: 'http://icon.com'
|
|
48
48
|
},
|
|
49
49
|
content: {
|
|
@@ -81,7 +81,7 @@ describe('TeamWorkGraphClient - setObjects', () => {
|
|
|
81
81
|
],
|
|
82
82
|
'atlassian:document': {
|
|
83
83
|
type: {
|
|
84
|
-
category: '
|
|
84
|
+
category: 'DOCUMENT',
|
|
85
85
|
iconUrl: 'http://icon.com'
|
|
86
86
|
},
|
|
87
87
|
content: {
|
|
@@ -91,13 +91,25 @@ describe('TeamWorkGraphClient - setObjects', () => {
|
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
const req = { objects: [documentObject] };
|
|
94
|
-
const
|
|
94
|
+
const backendResponse = {
|
|
95
|
+
accepted: [
|
|
96
|
+
{
|
|
97
|
+
entityType: 'atlassian:document',
|
|
98
|
+
entityId: { id: 'my-document' },
|
|
99
|
+
thirdPartyAri: 'ari:third-party:test::document/my-document'
|
|
100
|
+
}
|
|
101
|
+
]
|
|
102
|
+
};
|
|
103
|
+
const expected = {
|
|
104
|
+
success: true,
|
|
105
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
106
|
+
};
|
|
95
107
|
mockFetch.mockResolvedValueOnce({
|
|
96
108
|
ok: true,
|
|
97
|
-
json: () => Promise.resolve(
|
|
109
|
+
json: () => Promise.resolve(backendResponse)
|
|
98
110
|
});
|
|
99
111
|
const result = await graphClient.setObjects(req);
|
|
100
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
112
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
101
113
|
expect(result).toEqual(expected);
|
|
102
114
|
});
|
|
103
115
|
it('posts message entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -142,13 +154,25 @@ describe('TeamWorkGraphClient - setObjects', () => {
|
|
|
142
154
|
}
|
|
143
155
|
};
|
|
144
156
|
const req = { objects: [messageObject] };
|
|
145
|
-
const
|
|
157
|
+
const backendResponse = {
|
|
158
|
+
accepted: [
|
|
159
|
+
{
|
|
160
|
+
entityType: 'atlassian:message',
|
|
161
|
+
entityId: { id: 'message-1' },
|
|
162
|
+
thirdPartyAri: 'ari:third-party:test::message/message-1'
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
};
|
|
166
|
+
const expected = {
|
|
167
|
+
success: true,
|
|
168
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
169
|
+
};
|
|
146
170
|
mockFetch.mockResolvedValueOnce({
|
|
147
171
|
ok: true,
|
|
148
|
-
json: () => Promise.resolve(
|
|
172
|
+
json: () => Promise.resolve(backendResponse)
|
|
149
173
|
});
|
|
150
174
|
const result = await graphClient.setObjects(req);
|
|
151
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
175
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
152
176
|
expect(result).toEqual(expected);
|
|
153
177
|
});
|
|
154
178
|
it('posts organisation entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -182,13 +206,25 @@ describe('TeamWorkGraphClient - setObjects', () => {
|
|
|
182
206
|
'atlassian:organisation': {}
|
|
183
207
|
};
|
|
184
208
|
const req = { objects: [organisationObject] };
|
|
185
|
-
const
|
|
209
|
+
const backendResponse = {
|
|
210
|
+
accepted: [
|
|
211
|
+
{
|
|
212
|
+
entityType: 'atlassian:organisation',
|
|
213
|
+
entityId: { id: 'org-1' },
|
|
214
|
+
thirdPartyAri: 'ari:third-party:test::organisation/org-1'
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
};
|
|
218
|
+
const expected = {
|
|
219
|
+
success: true,
|
|
220
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
221
|
+
};
|
|
186
222
|
mockFetch.mockResolvedValueOnce({
|
|
187
223
|
ok: true,
|
|
188
|
-
json: () => Promise.resolve(
|
|
224
|
+
json: () => Promise.resolve(backendResponse)
|
|
189
225
|
});
|
|
190
226
|
const result = await graphClient.setObjects(req);
|
|
191
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
227
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
192
228
|
expect(result).toEqual(expected);
|
|
193
229
|
});
|
|
194
230
|
it('throws if objects is not an array', async () => {
|
|
@@ -224,13 +260,13 @@ describe('TeamWorkGraphClient - getObjectByExternalId', () => {
|
|
|
224
260
|
};
|
|
225
261
|
mockFetch.mockResolvedValueOnce({
|
|
226
262
|
ok: true,
|
|
227
|
-
json: () => Promise.resolve(expectedObject)
|
|
263
|
+
json: () => Promise.resolve({ entities: [expectedObject] })
|
|
228
264
|
});
|
|
229
265
|
const result = await graphClient.getObjectByExternalId({
|
|
230
266
|
objectType: 'atlassian:document',
|
|
231
267
|
externalId: 'pipelines/123/builds/456'
|
|
232
268
|
});
|
|
233
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
269
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.GET_BY_EXTERNAL_ID), {
|
|
234
270
|
method: 'POST',
|
|
235
271
|
redirect: 'follow',
|
|
236
272
|
headers: { 'Content-Type': 'application/json' },
|
|
@@ -291,22 +327,25 @@ describe('TeamWorkGraphClient - deleteObjectsByExternalId', () => {
|
|
|
291
327
|
jest.clearAllMocks();
|
|
292
328
|
});
|
|
293
329
|
it('should successfully delete objects in bulk', async () => {
|
|
330
|
+
const backendResponse = {
|
|
331
|
+
deleted: [
|
|
332
|
+
{ entityType: 'atlassian:document', entityId: { entityId: 'pipelines/123/builds/456' } },
|
|
333
|
+
{ entityType: 'atlassian:document', entityId: { entityId: 'pipelines/123/builds/789' } }
|
|
334
|
+
]
|
|
335
|
+
};
|
|
294
336
|
const expectedResponse = {
|
|
295
337
|
success: true,
|
|
296
|
-
results:
|
|
297
|
-
{ externalId: 'pipelines/123/builds/456', success: true },
|
|
298
|
-
{ externalId: 'pipelines/123/builds/789', success: true }
|
|
299
|
-
]
|
|
338
|
+
results: backendResponse.deleted
|
|
300
339
|
};
|
|
301
340
|
mockFetch.mockResolvedValueOnce({
|
|
302
341
|
ok: true,
|
|
303
|
-
json: () => Promise.resolve(
|
|
342
|
+
json: () => Promise.resolve(backendResponse)
|
|
304
343
|
});
|
|
305
344
|
const result = await graphClient.deleteObjectsByExternalId({
|
|
306
345
|
objectType: 'atlassian:document',
|
|
307
346
|
externalIds: ['pipelines/123/builds/456', 'pipelines/123/builds/789']
|
|
308
347
|
});
|
|
309
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
348
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK_DELETE), {
|
|
310
349
|
method: 'DELETE',
|
|
311
350
|
body: JSON.stringify({
|
|
312
351
|
entityType: 'atlassian:document',
|
|
@@ -368,7 +407,7 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
368
407
|
environment: 'staging',
|
|
369
408
|
status: 'failed'
|
|
370
409
|
});
|
|
371
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
410
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.DELETE_BY_PROPERTIES), {
|
|
372
411
|
method: 'DELETE',
|
|
373
412
|
body: JSON.stringify({
|
|
374
413
|
environment: 'staging',
|
|
@@ -395,7 +434,7 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
395
434
|
team: 'backend',
|
|
396
435
|
region: 'us-east-1'
|
|
397
436
|
});
|
|
398
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
437
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.DELETE_BY_PROPERTIES), {
|
|
399
438
|
method: 'DELETE',
|
|
400
439
|
body: JSON.stringify({
|
|
401
440
|
environment: 'production',
|
|
@@ -418,6 +457,16 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
418
457
|
it('should throw error when properties object is empty', async () => {
|
|
419
458
|
await expect(graphClient.deleteObjectsByProperties({})).rejects.toThrow('properties object cannot be empty');
|
|
420
459
|
});
|
|
460
|
+
});
|
|
461
|
+
describe('TeamWorkGraphClient - bulk entities', () => {
|
|
462
|
+
let graphClient;
|
|
463
|
+
let mockFetch;
|
|
464
|
+
beforeEach(() => {
|
|
465
|
+
graphClient = new graph_1.TeamWorkGraphClient();
|
|
466
|
+
mockFetch = jest.fn();
|
|
467
|
+
api_1.__fetchProduct.mockReturnValue(mockFetch);
|
|
468
|
+
jest.clearAllMocks();
|
|
469
|
+
});
|
|
421
470
|
it('posts branch entities to /api/v1/entities/bulk and returns response', async () => {
|
|
422
471
|
const branchObject = {
|
|
423
472
|
schemaVersion: '2.0',
|
|
@@ -443,13 +492,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
443
492
|
'atlassian:branch': {}
|
|
444
493
|
};
|
|
445
494
|
const req = { objects: [branchObject] };
|
|
446
|
-
const
|
|
495
|
+
const backendResponse = {
|
|
496
|
+
accepted: [
|
|
497
|
+
{
|
|
498
|
+
entityType: 'atlassian:branch',
|
|
499
|
+
entityId: { id: 'branch-1' },
|
|
500
|
+
thirdPartyAri: 'ari:third-party:test::branch/branch-1'
|
|
501
|
+
}
|
|
502
|
+
]
|
|
503
|
+
};
|
|
504
|
+
const expected = {
|
|
505
|
+
success: true,
|
|
506
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
507
|
+
};
|
|
447
508
|
mockFetch.mockResolvedValueOnce({
|
|
448
509
|
ok: true,
|
|
449
|
-
json: () => Promise.resolve(
|
|
510
|
+
json: () => Promise.resolve(backendResponse)
|
|
450
511
|
});
|
|
451
512
|
const result = await graphClient.setObjects(req);
|
|
452
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
513
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
453
514
|
expect(result).toEqual(expected);
|
|
454
515
|
});
|
|
455
516
|
it('posts commit entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -489,13 +550,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
489
550
|
}
|
|
490
551
|
};
|
|
491
552
|
const req = { objects: [commitObject] };
|
|
492
|
-
const
|
|
553
|
+
const backendResponse = {
|
|
554
|
+
accepted: [
|
|
555
|
+
{
|
|
556
|
+
entityType: 'atlassian:commit',
|
|
557
|
+
entityId: { id: 'commit-1' },
|
|
558
|
+
thirdPartyAri: 'ari:third-party:test::commit/commit-1'
|
|
559
|
+
}
|
|
560
|
+
]
|
|
561
|
+
};
|
|
562
|
+
const expected = {
|
|
563
|
+
success: true,
|
|
564
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
565
|
+
};
|
|
493
566
|
mockFetch.mockResolvedValueOnce({
|
|
494
567
|
ok: true,
|
|
495
|
-
json: () => Promise.resolve(
|
|
568
|
+
json: () => Promise.resolve(backendResponse)
|
|
496
569
|
});
|
|
497
570
|
const result = await graphClient.setObjects(req);
|
|
498
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
571
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
499
572
|
expect(result).toEqual(expected);
|
|
500
573
|
});
|
|
501
574
|
it('posts build entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -547,13 +620,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
547
620
|
}
|
|
548
621
|
};
|
|
549
622
|
const req = { objects: [buildObject] };
|
|
550
|
-
const
|
|
623
|
+
const backendResponse = {
|
|
624
|
+
accepted: [
|
|
625
|
+
{
|
|
626
|
+
entityType: 'atlassian:build',
|
|
627
|
+
entityId: { id: 'build-1' },
|
|
628
|
+
thirdPartyAri: 'ari:third-party:test::build/build-1'
|
|
629
|
+
}
|
|
630
|
+
]
|
|
631
|
+
};
|
|
632
|
+
const expected = {
|
|
633
|
+
success: true,
|
|
634
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
635
|
+
};
|
|
551
636
|
mockFetch.mockResolvedValueOnce({
|
|
552
637
|
ok: true,
|
|
553
|
-
json: () => Promise.resolve(
|
|
638
|
+
json: () => Promise.resolve(backendResponse)
|
|
554
639
|
});
|
|
555
640
|
const result = await graphClient.setObjects(req);
|
|
556
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
641
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
557
642
|
expect(result).toEqual(expected);
|
|
558
643
|
});
|
|
559
644
|
it('posts calendar event entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -620,13 +705,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
620
705
|
}
|
|
621
706
|
};
|
|
622
707
|
const req = { objects: [calendarEventObject] };
|
|
623
|
-
const
|
|
708
|
+
const backendResponse = {
|
|
709
|
+
accepted: [
|
|
710
|
+
{
|
|
711
|
+
entityType: 'atlassian:calendar-event',
|
|
712
|
+
entityId: { id: 'calendar-event-1' },
|
|
713
|
+
thirdPartyAri: 'ari:third-party:test::calendar-event/calendar-event-1'
|
|
714
|
+
}
|
|
715
|
+
]
|
|
716
|
+
};
|
|
717
|
+
const expected = {
|
|
718
|
+
success: true,
|
|
719
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
720
|
+
};
|
|
624
721
|
mockFetch.mockResolvedValueOnce({
|
|
625
722
|
ok: true,
|
|
626
|
-
json: () => Promise.resolve(
|
|
723
|
+
json: () => Promise.resolve(backendResponse)
|
|
627
724
|
});
|
|
628
725
|
const result = await graphClient.setObjects(req);
|
|
629
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
726
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
630
727
|
expect(result).toEqual(expected);
|
|
631
728
|
});
|
|
632
729
|
it('posts comment entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -667,13 +764,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
667
764
|
}
|
|
668
765
|
};
|
|
669
766
|
const req = { objects: [commentObject] };
|
|
670
|
-
const
|
|
767
|
+
const backendResponse = {
|
|
768
|
+
accepted: [
|
|
769
|
+
{
|
|
770
|
+
entityType: 'atlassian:comment',
|
|
771
|
+
entityId: { id: 'comment-1' },
|
|
772
|
+
thirdPartyAri: 'ari:third-party:test::comment/comment-1'
|
|
773
|
+
}
|
|
774
|
+
]
|
|
775
|
+
};
|
|
776
|
+
const expected = {
|
|
777
|
+
success: true,
|
|
778
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
779
|
+
};
|
|
671
780
|
mockFetch.mockResolvedValueOnce({
|
|
672
781
|
ok: true,
|
|
673
|
-
json: () => Promise.resolve(
|
|
782
|
+
json: () => Promise.resolve(backendResponse)
|
|
674
783
|
});
|
|
675
784
|
const result = await graphClient.setObjects(req);
|
|
676
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
785
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
677
786
|
expect(result).toEqual(expected);
|
|
678
787
|
});
|
|
679
788
|
it('posts conversation entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -733,13 +842,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
733
842
|
}
|
|
734
843
|
};
|
|
735
844
|
const req = { objects: [conversationObject] };
|
|
736
|
-
const
|
|
845
|
+
const backendResponse = {
|
|
846
|
+
accepted: [
|
|
847
|
+
{
|
|
848
|
+
entityType: 'atlassian:conversation',
|
|
849
|
+
entityId: { id: 'conversation-1' },
|
|
850
|
+
thirdPartyAri: 'ari:third-party:test::conversation/conversation-1'
|
|
851
|
+
}
|
|
852
|
+
]
|
|
853
|
+
};
|
|
854
|
+
const expected = {
|
|
855
|
+
success: true,
|
|
856
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
857
|
+
};
|
|
737
858
|
mockFetch.mockResolvedValueOnce({
|
|
738
859
|
ok: true,
|
|
739
|
-
json: () => Promise.resolve(
|
|
860
|
+
json: () => Promise.resolve(backendResponse)
|
|
740
861
|
});
|
|
741
862
|
const result = await graphClient.setObjects(req);
|
|
742
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
863
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
743
864
|
expect(result).toEqual(expected);
|
|
744
865
|
});
|
|
745
866
|
it('posts customer org entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -808,13 +929,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
808
929
|
}
|
|
809
930
|
};
|
|
810
931
|
const req = { objects: [customerOrgObject] };
|
|
811
|
-
const
|
|
932
|
+
const backendResponse = {
|
|
933
|
+
accepted: [
|
|
934
|
+
{
|
|
935
|
+
entityType: 'atlassian:customer-org',
|
|
936
|
+
entityId: { id: 'customer-org-1' },
|
|
937
|
+
thirdPartyAri: 'ari:third-party:test::customer-org/customer-org-1'
|
|
938
|
+
}
|
|
939
|
+
]
|
|
940
|
+
};
|
|
941
|
+
const expected = {
|
|
942
|
+
success: true,
|
|
943
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
944
|
+
};
|
|
812
945
|
mockFetch.mockResolvedValueOnce({
|
|
813
946
|
ok: true,
|
|
814
|
-
json: () => Promise.resolve(
|
|
947
|
+
json: () => Promise.resolve(backendResponse)
|
|
815
948
|
});
|
|
816
949
|
const result = await graphClient.setObjects(req);
|
|
817
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
950
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
818
951
|
expect(result).toEqual(expected);
|
|
819
952
|
});
|
|
820
953
|
it('posts deal entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -883,13 +1016,21 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
883
1016
|
}
|
|
884
1017
|
};
|
|
885
1018
|
const req = { objects: [dealObject] };
|
|
886
|
-
const
|
|
1019
|
+
const backendResponse = {
|
|
1020
|
+
accepted: [
|
|
1021
|
+
{ entityType: 'atlassian:deal', entityId: { id: 'deal-1' }, thirdPartyAri: 'ari:third-party:test::deal/deal-1' }
|
|
1022
|
+
]
|
|
1023
|
+
};
|
|
1024
|
+
const expected = {
|
|
1025
|
+
success: true,
|
|
1026
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1027
|
+
};
|
|
887
1028
|
mockFetch.mockResolvedValueOnce({
|
|
888
1029
|
ok: true,
|
|
889
|
-
json: () => Promise.resolve(
|
|
1030
|
+
json: () => Promise.resolve(backendResponse)
|
|
890
1031
|
});
|
|
891
1032
|
const result = await graphClient.setObjects(req);
|
|
892
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1033
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
893
1034
|
expect(result).toEqual(expected);
|
|
894
1035
|
});
|
|
895
1036
|
it('posts deployment entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -954,13 +1095,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
954
1095
|
}
|
|
955
1096
|
};
|
|
956
1097
|
const req = { objects: [deploymentObject] };
|
|
957
|
-
const
|
|
1098
|
+
const backendResponse = {
|
|
1099
|
+
accepted: [
|
|
1100
|
+
{
|
|
1101
|
+
entityType: 'atlassian:deployment',
|
|
1102
|
+
entityId: { id: 'deployment-1' },
|
|
1103
|
+
thirdPartyAri: 'ari:third-party:test::deployment/deployment-1'
|
|
1104
|
+
}
|
|
1105
|
+
]
|
|
1106
|
+
};
|
|
1107
|
+
const expected = {
|
|
1108
|
+
success: true,
|
|
1109
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1110
|
+
};
|
|
958
1111
|
mockFetch.mockResolvedValueOnce({
|
|
959
1112
|
ok: true,
|
|
960
|
-
json: () => Promise.resolve(
|
|
1113
|
+
json: () => Promise.resolve(backendResponse)
|
|
961
1114
|
});
|
|
962
1115
|
const result = await graphClient.setObjects(req);
|
|
963
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1116
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
964
1117
|
expect(result).toEqual(expected);
|
|
965
1118
|
});
|
|
966
1119
|
it('posts design entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -995,13 +1148,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
995
1148
|
}
|
|
996
1149
|
};
|
|
997
1150
|
const req = { objects: [designObject] };
|
|
998
|
-
const
|
|
1151
|
+
const backendResponse = {
|
|
1152
|
+
accepted: [
|
|
1153
|
+
{
|
|
1154
|
+
entityType: 'atlassian:design',
|
|
1155
|
+
entityId: { id: 'design-1' },
|
|
1156
|
+
thirdPartyAri: 'ari:third-party:test::design/design-1'
|
|
1157
|
+
}
|
|
1158
|
+
]
|
|
1159
|
+
};
|
|
1160
|
+
const expected = {
|
|
1161
|
+
success: true,
|
|
1162
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1163
|
+
};
|
|
999
1164
|
mockFetch.mockResolvedValueOnce({
|
|
1000
1165
|
ok: true,
|
|
1001
|
-
json: () => Promise.resolve(
|
|
1166
|
+
json: () => Promise.resolve(backendResponse)
|
|
1002
1167
|
});
|
|
1003
1168
|
const result = await graphClient.setObjects(req);
|
|
1004
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1169
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1005
1170
|
expect(result).toEqual(expected);
|
|
1006
1171
|
});
|
|
1007
1172
|
it('posts position entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1047,13 +1212,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1047
1212
|
}
|
|
1048
1213
|
};
|
|
1049
1214
|
const req = { objects: [positionObject] };
|
|
1050
|
-
const
|
|
1215
|
+
const backendResponse = {
|
|
1216
|
+
accepted: [
|
|
1217
|
+
{
|
|
1218
|
+
entityType: 'atlassian:position',
|
|
1219
|
+
entityId: { id: 'position-1' },
|
|
1220
|
+
thirdPartyAri: 'ari:third-party:test::position/position-1'
|
|
1221
|
+
}
|
|
1222
|
+
]
|
|
1223
|
+
};
|
|
1224
|
+
const expected = {
|
|
1225
|
+
success: true,
|
|
1226
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1227
|
+
};
|
|
1051
1228
|
mockFetch.mockResolvedValueOnce({
|
|
1052
1229
|
ok: true,
|
|
1053
|
-
json: () => Promise.resolve(
|
|
1230
|
+
json: () => Promise.resolve(backendResponse)
|
|
1054
1231
|
});
|
|
1055
1232
|
const result = await graphClient.setObjects(req);
|
|
1056
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1233
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1057
1234
|
expect(result).toEqual(expected);
|
|
1058
1235
|
});
|
|
1059
1236
|
it('posts project entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1128,13 +1305,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1128
1305
|
}
|
|
1129
1306
|
};
|
|
1130
1307
|
const req = { objects: [projectObject] };
|
|
1131
|
-
const
|
|
1308
|
+
const backendResponse = {
|
|
1309
|
+
accepted: [
|
|
1310
|
+
{
|
|
1311
|
+
entityType: 'atlassian:project',
|
|
1312
|
+
entityId: { id: 'project-1' },
|
|
1313
|
+
thirdPartyAri: 'ari:third-party:test::project/project-1'
|
|
1314
|
+
}
|
|
1315
|
+
]
|
|
1316
|
+
};
|
|
1317
|
+
const expected = {
|
|
1318
|
+
success: true,
|
|
1319
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1320
|
+
};
|
|
1132
1321
|
mockFetch.mockResolvedValueOnce({
|
|
1133
1322
|
ok: true,
|
|
1134
|
-
json: () => Promise.resolve(
|
|
1323
|
+
json: () => Promise.resolve(backendResponse)
|
|
1135
1324
|
});
|
|
1136
1325
|
const result = await graphClient.setObjects(req);
|
|
1137
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1326
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1138
1327
|
expect(result).toEqual(expected);
|
|
1139
1328
|
});
|
|
1140
1329
|
it('posts pull request entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1210,13 +1399,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1210
1399
|
}
|
|
1211
1400
|
};
|
|
1212
1401
|
const req = { objects: [pullRequestObject] };
|
|
1213
|
-
const
|
|
1402
|
+
const backendResponse = {
|
|
1403
|
+
accepted: [
|
|
1404
|
+
{
|
|
1405
|
+
entityType: 'atlassian:pull-request',
|
|
1406
|
+
entityId: { id: 'pr-1' },
|
|
1407
|
+
thirdPartyAri: 'ari:third-party:test::pull-request/pr-1'
|
|
1408
|
+
}
|
|
1409
|
+
]
|
|
1410
|
+
};
|
|
1411
|
+
const expected = {
|
|
1412
|
+
success: true,
|
|
1413
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1414
|
+
};
|
|
1214
1415
|
mockFetch.mockResolvedValueOnce({
|
|
1215
1416
|
ok: true,
|
|
1216
|
-
json: () => Promise.resolve(
|
|
1417
|
+
json: () => Promise.resolve(backendResponse)
|
|
1217
1418
|
});
|
|
1218
1419
|
const result = await graphClient.setObjects(req);
|
|
1219
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1420
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1220
1421
|
expect(result).toEqual(expected);
|
|
1221
1422
|
});
|
|
1222
1423
|
it('posts remote link entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1276,13 +1477,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1276
1477
|
}
|
|
1277
1478
|
};
|
|
1278
1479
|
const req = { objects: [remoteLinkObject] };
|
|
1279
|
-
const
|
|
1480
|
+
const backendResponse = {
|
|
1481
|
+
accepted: [
|
|
1482
|
+
{
|
|
1483
|
+
entityType: 'atlassian:remote-link',
|
|
1484
|
+
entityId: { id: 'remote-link-1' },
|
|
1485
|
+
thirdPartyAri: 'ari:third-party:test::remote-link/remote-link-1'
|
|
1486
|
+
}
|
|
1487
|
+
]
|
|
1488
|
+
};
|
|
1489
|
+
const expected = {
|
|
1490
|
+
success: true,
|
|
1491
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1492
|
+
};
|
|
1280
1493
|
mockFetch.mockResolvedValueOnce({
|
|
1281
1494
|
ok: true,
|
|
1282
|
-
json: () => Promise.resolve(
|
|
1495
|
+
json: () => Promise.resolve(backendResponse)
|
|
1283
1496
|
});
|
|
1284
1497
|
const result = await graphClient.setObjects(req);
|
|
1285
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1498
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1286
1499
|
expect(result).toEqual(expected);
|
|
1287
1500
|
});
|
|
1288
1501
|
it('posts repository entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1315,13 +1528,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1315
1528
|
}
|
|
1316
1529
|
};
|
|
1317
1530
|
const req = { objects: [repositoryObject] };
|
|
1318
|
-
const
|
|
1531
|
+
const backendResponse = {
|
|
1532
|
+
accepted: [
|
|
1533
|
+
{
|
|
1534
|
+
entityType: 'atlassian:repository',
|
|
1535
|
+
entityId: { id: 'repository-1' },
|
|
1536
|
+
thirdPartyAri: 'ari:third-party:test::repository/repository-1'
|
|
1537
|
+
}
|
|
1538
|
+
]
|
|
1539
|
+
};
|
|
1540
|
+
const expected = {
|
|
1541
|
+
success: true,
|
|
1542
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1543
|
+
};
|
|
1319
1544
|
mockFetch.mockResolvedValueOnce({
|
|
1320
1545
|
ok: true,
|
|
1321
|
-
json: () => Promise.resolve(
|
|
1546
|
+
json: () => Promise.resolve(backendResponse)
|
|
1322
1547
|
});
|
|
1323
1548
|
const result = await graphClient.setObjects(req);
|
|
1324
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1549
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1325
1550
|
expect(result).toEqual(expected);
|
|
1326
1551
|
});
|
|
1327
1552
|
it('posts software service entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1363,13 +1588,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1363
1588
|
}
|
|
1364
1589
|
};
|
|
1365
1590
|
const req = { objects: [softwareServiceObject] };
|
|
1366
|
-
const
|
|
1591
|
+
const backendResponse = {
|
|
1592
|
+
accepted: [
|
|
1593
|
+
{
|
|
1594
|
+
entityType: 'atlassian:software-service',
|
|
1595
|
+
entityId: { id: 'software-service-1' },
|
|
1596
|
+
thirdPartyAri: 'ari:third-party:test::software-service/software-service-1'
|
|
1597
|
+
}
|
|
1598
|
+
]
|
|
1599
|
+
};
|
|
1600
|
+
const expected = {
|
|
1601
|
+
success: true,
|
|
1602
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1603
|
+
};
|
|
1367
1604
|
mockFetch.mockResolvedValueOnce({
|
|
1368
1605
|
ok: true,
|
|
1369
|
-
json: () => Promise.resolve(
|
|
1606
|
+
json: () => Promise.resolve(backendResponse)
|
|
1370
1607
|
});
|
|
1371
1608
|
const result = await graphClient.setObjects(req);
|
|
1372
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1609
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1373
1610
|
expect(result).toEqual(expected);
|
|
1374
1611
|
});
|
|
1375
1612
|
it('posts space entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1408,13 +1645,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1408
1645
|
}
|
|
1409
1646
|
};
|
|
1410
1647
|
const req = { objects: [spaceObject] };
|
|
1411
|
-
const
|
|
1648
|
+
const backendResponse = {
|
|
1649
|
+
accepted: [
|
|
1650
|
+
{
|
|
1651
|
+
entityType: 'atlassian:space',
|
|
1652
|
+
entityId: { id: 'space-1' },
|
|
1653
|
+
thirdPartyAri: 'ari:third-party:test::space/space-1'
|
|
1654
|
+
}
|
|
1655
|
+
]
|
|
1656
|
+
};
|
|
1657
|
+
const expected = {
|
|
1658
|
+
success: true,
|
|
1659
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1660
|
+
};
|
|
1412
1661
|
mockFetch.mockResolvedValueOnce({
|
|
1413
1662
|
ok: true,
|
|
1414
|
-
json: () => Promise.resolve(
|
|
1663
|
+
json: () => Promise.resolve(backendResponse)
|
|
1415
1664
|
});
|
|
1416
1665
|
const result = await graphClient.setObjects(req);
|
|
1417
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1666
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1418
1667
|
expect(result).toEqual(expected);
|
|
1419
1668
|
});
|
|
1420
1669
|
it('posts video entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1525,13 +1774,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1525
1774
|
}
|
|
1526
1775
|
};
|
|
1527
1776
|
const req = { objects: [videoObject] };
|
|
1528
|
-
const
|
|
1777
|
+
const backendResponse = {
|
|
1778
|
+
accepted: [
|
|
1779
|
+
{
|
|
1780
|
+
entityType: 'atlassian:video',
|
|
1781
|
+
entityId: { id: 'video-1' },
|
|
1782
|
+
thirdPartyAri: 'ari:third-party:test::video/video-1'
|
|
1783
|
+
}
|
|
1784
|
+
]
|
|
1785
|
+
};
|
|
1786
|
+
const expected = {
|
|
1787
|
+
success: true,
|
|
1788
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1789
|
+
};
|
|
1529
1790
|
mockFetch.mockResolvedValueOnce({
|
|
1530
1791
|
ok: true,
|
|
1531
|
-
json: () => Promise.resolve(
|
|
1792
|
+
json: () => Promise.resolve(backendResponse)
|
|
1532
1793
|
});
|
|
1533
1794
|
const result = await graphClient.setObjects(req);
|
|
1534
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1795
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1535
1796
|
expect(result).toEqual(expected);
|
|
1536
1797
|
});
|
|
1537
1798
|
it('posts work item entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1621,13 +1882,25 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1621
1882
|
}
|
|
1622
1883
|
};
|
|
1623
1884
|
const req = { objects: [workItemObject] };
|
|
1624
|
-
const
|
|
1885
|
+
const backendResponse = {
|
|
1886
|
+
accepted: [
|
|
1887
|
+
{
|
|
1888
|
+
entityType: 'atlassian:work-item',
|
|
1889
|
+
entityId: { id: 'work-item-1' },
|
|
1890
|
+
thirdPartyAri: 'ari:third-party:test::work-item/work-item-1'
|
|
1891
|
+
}
|
|
1892
|
+
]
|
|
1893
|
+
};
|
|
1894
|
+
const expected = {
|
|
1895
|
+
success: true,
|
|
1896
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1897
|
+
};
|
|
1625
1898
|
mockFetch.mockResolvedValueOnce({
|
|
1626
1899
|
ok: true,
|
|
1627
|
-
json: () => Promise.resolve(
|
|
1900
|
+
json: () => Promise.resolve(backendResponse)
|
|
1628
1901
|
});
|
|
1629
1902
|
const result = await graphClient.setObjects(req);
|
|
1630
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1903
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1631
1904
|
expect(result).toEqual(expected);
|
|
1632
1905
|
});
|
|
1633
1906
|
it('posts worker entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1668,13 +1941,315 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
1668
1941
|
}
|
|
1669
1942
|
};
|
|
1670
1943
|
const req = { objects: [workerObject] };
|
|
1671
|
-
const
|
|
1944
|
+
const backendResponse = {
|
|
1945
|
+
accepted: [
|
|
1946
|
+
{
|
|
1947
|
+
entityType: 'atlassian:worker',
|
|
1948
|
+
entityId: { id: 'worker-1' },
|
|
1949
|
+
thirdPartyAri: 'ari:third-party:test::worker/worker-1'
|
|
1950
|
+
}
|
|
1951
|
+
]
|
|
1952
|
+
};
|
|
1953
|
+
const expected = {
|
|
1954
|
+
success: true,
|
|
1955
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1956
|
+
};
|
|
1957
|
+
mockFetch.mockResolvedValueOnce({
|
|
1958
|
+
ok: true,
|
|
1959
|
+
json: () => Promise.resolve(backendResponse)
|
|
1960
|
+
});
|
|
1961
|
+
const result = await graphClient.setObjects(req);
|
|
1962
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1963
|
+
expect(result).toEqual(expected);
|
|
1964
|
+
});
|
|
1965
|
+
it('posts dashboard entities to /api/v1/entities/bulk and returns response', async () => {
|
|
1966
|
+
const dashboardObject = {
|
|
1967
|
+
schemaVersion: '2.0',
|
|
1968
|
+
id: 'dashboard-1',
|
|
1969
|
+
updateSequenceNumber: 1,
|
|
1970
|
+
displayName: 'Analytics Dashboard',
|
|
1971
|
+
description: 'Main analytics dashboard for sales data',
|
|
1972
|
+
url: 'https://analytics.example.com/dashboard/sales',
|
|
1973
|
+
createdAt: '2024-07-09T14:27:37.000Z',
|
|
1974
|
+
lastUpdatedAt: '2024-07-09T14:27:37.000Z',
|
|
1975
|
+
permissions: [
|
|
1976
|
+
{
|
|
1977
|
+
accessControls: [
|
|
1978
|
+
{
|
|
1979
|
+
principals: [
|
|
1980
|
+
{
|
|
1981
|
+
type: 'EVERYONE'
|
|
1982
|
+
}
|
|
1983
|
+
]
|
|
1984
|
+
}
|
|
1985
|
+
]
|
|
1986
|
+
}
|
|
1987
|
+
],
|
|
1988
|
+
'atlassian:dashboard': {
|
|
1989
|
+
description: 'Real-time sales analytics and performance metrics',
|
|
1990
|
+
workspaceName: 'Sales Analytics Workspace',
|
|
1991
|
+
pages: [{ name: 'Overview' }, { name: 'Sales Metrics' }],
|
|
1992
|
+
elements: [
|
|
1993
|
+
{
|
|
1994
|
+
name: 'Revenue Chart',
|
|
1995
|
+
innerComponents: ['chart-widget', 'filter-panel']
|
|
1996
|
+
}
|
|
1997
|
+
]
|
|
1998
|
+
}
|
|
1999
|
+
};
|
|
2000
|
+
const req = { objects: [dashboardObject] };
|
|
2001
|
+
const backendResponse = {
|
|
2002
|
+
accepted: [
|
|
2003
|
+
{
|
|
2004
|
+
entityType: 'atlassian:dashboard',
|
|
2005
|
+
entityId: { id: 'dashboard-1' },
|
|
2006
|
+
thirdPartyAri: 'ari:third-party:test::dashboard/dashboard-1'
|
|
2007
|
+
}
|
|
2008
|
+
]
|
|
2009
|
+
};
|
|
2010
|
+
const expected = {
|
|
2011
|
+
success: true,
|
|
2012
|
+
results: {
|
|
2013
|
+
accepted: backendResponse.accepted,
|
|
2014
|
+
rejected: undefined,
|
|
2015
|
+
validEntities: undefined
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
mockFetch.mockResolvedValueOnce({
|
|
2019
|
+
ok: true,
|
|
2020
|
+
json: () => Promise.resolve(backendResponse)
|
|
2021
|
+
});
|
|
2022
|
+
const result = await graphClient.setObjects(req);
|
|
2023
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
2024
|
+
expect(result).toEqual(expected);
|
|
2025
|
+
});
|
|
2026
|
+
it('posts test entities to /api/v1/entities/bulk and returns response', async () => {
|
|
2027
|
+
const testObject = {
|
|
2028
|
+
schemaVersion: '2.0',
|
|
2029
|
+
id: 'test-1',
|
|
2030
|
+
updateSequenceNumber: 1,
|
|
2031
|
+
displayName: 'Login API Test',
|
|
2032
|
+
description: 'Test case for user login API endpoint',
|
|
2033
|
+
url: 'https://testmanagement.example.com/tests/login-api',
|
|
2034
|
+
createdAt: '2024-07-09T14:27:37.000Z',
|
|
2035
|
+
lastUpdatedAt: '2024-07-09T14:27:37.000Z',
|
|
2036
|
+
permissions: [
|
|
2037
|
+
{
|
|
2038
|
+
accessControls: [
|
|
2039
|
+
{
|
|
2040
|
+
principals: [
|
|
2041
|
+
{
|
|
2042
|
+
type: 'EVERYONE'
|
|
2043
|
+
}
|
|
2044
|
+
]
|
|
2045
|
+
}
|
|
2046
|
+
]
|
|
2047
|
+
}
|
|
2048
|
+
],
|
|
2049
|
+
'atlassian:test': {
|
|
2050
|
+
status: 'active',
|
|
2051
|
+
testType: 'integration',
|
|
2052
|
+
statusPrecedence: 'high',
|
|
2053
|
+
version: '1.2.0',
|
|
2054
|
+
environment: 'staging'
|
|
2055
|
+
}
|
|
2056
|
+
};
|
|
2057
|
+
const req = { objects: [testObject] };
|
|
2058
|
+
const backendResponse = {
|
|
2059
|
+
accepted: [
|
|
2060
|
+
{
|
|
2061
|
+
entityType: 'atlassian:test',
|
|
2062
|
+
entityId: { id: 'test-1' },
|
|
2063
|
+
thirdPartyAri: 'ari:third-party:test::test/test-1'
|
|
2064
|
+
}
|
|
2065
|
+
]
|
|
2066
|
+
};
|
|
2067
|
+
const expected = {
|
|
2068
|
+
success: true,
|
|
2069
|
+
results: {
|
|
2070
|
+
accepted: backendResponse.accepted,
|
|
2071
|
+
rejected: undefined,
|
|
2072
|
+
validEntities: undefined
|
|
2073
|
+
}
|
|
2074
|
+
};
|
|
2075
|
+
mockFetch.mockResolvedValueOnce({
|
|
2076
|
+
ok: true,
|
|
2077
|
+
json: () => Promise.resolve(backendResponse)
|
|
2078
|
+
});
|
|
2079
|
+
const result = await graphClient.setObjects(req);
|
|
2080
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
2081
|
+
expect(result).toEqual(expected);
|
|
2082
|
+
});
|
|
2083
|
+
it('posts test execution entities to /api/v1/entities/bulk and returns response', async () => {
|
|
2084
|
+
const testExecutionObject = {
|
|
2085
|
+
schemaVersion: '2.0',
|
|
2086
|
+
id: 'test-execution-1',
|
|
2087
|
+
updateSequenceNumber: 1,
|
|
2088
|
+
displayName: 'Login API Test Execution - Run #42',
|
|
2089
|
+
description: 'Execution of login API test in staging environment',
|
|
2090
|
+
url: 'https://testmanagement.example.com/executions/login-api-42',
|
|
2091
|
+
createdAt: '2024-07-09T14:27:37.000Z',
|
|
2092
|
+
lastUpdatedAt: '2024-07-09T14:27:37.000Z',
|
|
2093
|
+
permissions: [
|
|
2094
|
+
{
|
|
2095
|
+
accessControls: [
|
|
2096
|
+
{
|
|
2097
|
+
principals: [
|
|
2098
|
+
{
|
|
2099
|
+
type: 'EVERYONE'
|
|
2100
|
+
}
|
|
2101
|
+
]
|
|
2102
|
+
}
|
|
2103
|
+
]
|
|
2104
|
+
}
|
|
2105
|
+
],
|
|
2106
|
+
'atlassian:test-execution': {
|
|
2107
|
+
status: 'passed',
|
|
2108
|
+
version: '1.2.0',
|
|
2109
|
+
environment: 'staging'
|
|
2110
|
+
}
|
|
2111
|
+
};
|
|
2112
|
+
const req = { objects: [testExecutionObject] };
|
|
2113
|
+
const backendResponse = {
|
|
2114
|
+
accepted: [
|
|
2115
|
+
{
|
|
2116
|
+
entityType: 'atlassian:test-execution',
|
|
2117
|
+
entityId: { id: 'test-execution-1' },
|
|
2118
|
+
thirdPartyAri: 'ari:third-party:test::test-execution/test-execution-1'
|
|
2119
|
+
}
|
|
2120
|
+
]
|
|
2121
|
+
};
|
|
2122
|
+
const expected = {
|
|
2123
|
+
success: true,
|
|
2124
|
+
results: {
|
|
2125
|
+
accepted: backendResponse.accepted,
|
|
2126
|
+
rejected: undefined,
|
|
2127
|
+
validEntities: undefined
|
|
2128
|
+
}
|
|
2129
|
+
};
|
|
2130
|
+
mockFetch.mockResolvedValueOnce({
|
|
2131
|
+
ok: true,
|
|
2132
|
+
json: () => Promise.resolve(backendResponse)
|
|
2133
|
+
});
|
|
2134
|
+
const result = await graphClient.setObjects(req);
|
|
2135
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
2136
|
+
expect(result).toEqual(expected);
|
|
2137
|
+
});
|
|
2138
|
+
it('posts test plan entities to /api/v1/entities/bulk and returns response', async () => {
|
|
2139
|
+
const testPlanObject = {
|
|
2140
|
+
schemaVersion: '2.0',
|
|
2141
|
+
id: 'test-plan-1',
|
|
2142
|
+
updateSequenceNumber: 1,
|
|
2143
|
+
displayName: 'Q4 Release Test Plan',
|
|
2144
|
+
description: 'Comprehensive test plan for Q4 release cycle',
|
|
2145
|
+
url: 'https://testmanagement.example.com/plans/q4-release',
|
|
2146
|
+
createdAt: '2024-07-09T14:27:37.000Z',
|
|
2147
|
+
lastUpdatedAt: '2024-07-09T14:27:37.000Z',
|
|
2148
|
+
permissions: [
|
|
2149
|
+
{
|
|
2150
|
+
accessControls: [
|
|
2151
|
+
{
|
|
2152
|
+
principals: [
|
|
2153
|
+
{
|
|
2154
|
+
type: 'EVERYONE'
|
|
2155
|
+
}
|
|
2156
|
+
]
|
|
2157
|
+
}
|
|
2158
|
+
]
|
|
2159
|
+
}
|
|
2160
|
+
],
|
|
2161
|
+
'atlassian:test-plan': {}
|
|
2162
|
+
};
|
|
2163
|
+
const req = { objects: [testPlanObject] };
|
|
2164
|
+
const backendResponse = {
|
|
2165
|
+
accepted: [
|
|
2166
|
+
{
|
|
2167
|
+
entityType: 'atlassian:test-plan',
|
|
2168
|
+
entityId: { id: 'test-plan-1' },
|
|
2169
|
+
thirdPartyAri: 'ari:third-party:test::test-plan/test-plan-1'
|
|
2170
|
+
}
|
|
2171
|
+
]
|
|
2172
|
+
};
|
|
2173
|
+
const expected = {
|
|
2174
|
+
success: true,
|
|
2175
|
+
results: {
|
|
2176
|
+
accepted: backendResponse.accepted,
|
|
2177
|
+
rejected: undefined,
|
|
2178
|
+
validEntities: undefined
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
mockFetch.mockResolvedValueOnce({
|
|
2182
|
+
ok: true,
|
|
2183
|
+
json: () => Promise.resolve(backendResponse)
|
|
2184
|
+
});
|
|
2185
|
+
const result = await graphClient.setObjects(req);
|
|
2186
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
2187
|
+
expect(result).toEqual(expected);
|
|
2188
|
+
});
|
|
2189
|
+
it('posts test run entities to /api/v1/entities/bulk and returns response', async () => {
|
|
2190
|
+
const testRunObject = {
|
|
2191
|
+
schemaVersion: '2.0',
|
|
2192
|
+
id: 'test-run-1',
|
|
2193
|
+
updateSequenceNumber: 1,
|
|
2194
|
+
displayName: 'Sprint 23 Regression Test Run',
|
|
2195
|
+
description: 'Regression test run for sprint 23 release candidate',
|
|
2196
|
+
url: 'https://testmanagement.example.com/runs/sprint-23-regression',
|
|
2197
|
+
createdAt: '2024-07-09T14:27:37.000Z',
|
|
2198
|
+
lastUpdatedAt: '2024-07-09T14:27:37.000Z',
|
|
2199
|
+
permissions: [
|
|
2200
|
+
{
|
|
2201
|
+
accessControls: [
|
|
2202
|
+
{
|
|
2203
|
+
principals: [
|
|
2204
|
+
{
|
|
2205
|
+
type: 'EVERYONE'
|
|
2206
|
+
}
|
|
2207
|
+
]
|
|
2208
|
+
}
|
|
2209
|
+
]
|
|
2210
|
+
}
|
|
2211
|
+
],
|
|
2212
|
+
'atlassian:test-run': {
|
|
2213
|
+
status: 'in-progress',
|
|
2214
|
+
assignee: {
|
|
2215
|
+
accountId: 'tester-alice-123',
|
|
2216
|
+
externalId: 'alice-tester-456',
|
|
2217
|
+
name: 'Alice Tester',
|
|
2218
|
+
userName: 'atester',
|
|
2219
|
+
email: 'alice.tester@example.com',
|
|
2220
|
+
avatar: 'https://avatar.example.com/alice.jpg',
|
|
2221
|
+
url: 'https://company.com/people/alice.tester',
|
|
2222
|
+
ari: 'ari:cloud:identity::user/tester-alice-123'
|
|
2223
|
+
},
|
|
2224
|
+
startedAt: '2024-07-09T09:00:00.000Z',
|
|
2225
|
+
version: '1.2.0',
|
|
2226
|
+
environment: 'staging'
|
|
2227
|
+
}
|
|
2228
|
+
};
|
|
2229
|
+
const req = { objects: [testRunObject] };
|
|
2230
|
+
const backendResponse = {
|
|
2231
|
+
accepted: [
|
|
2232
|
+
{
|
|
2233
|
+
entityType: 'atlassian:test-run',
|
|
2234
|
+
entityId: { id: 'test-run-1' },
|
|
2235
|
+
thirdPartyAri: 'ari:third-party:test::test-run/test-run-1'
|
|
2236
|
+
}
|
|
2237
|
+
]
|
|
2238
|
+
};
|
|
2239
|
+
const expected = {
|
|
2240
|
+
success: true,
|
|
2241
|
+
results: {
|
|
2242
|
+
accepted: backendResponse.accepted,
|
|
2243
|
+
rejected: undefined,
|
|
2244
|
+
validEntities: undefined
|
|
2245
|
+
}
|
|
2246
|
+
};
|
|
1672
2247
|
mockFetch.mockResolvedValueOnce({
|
|
1673
2248
|
ok: true,
|
|
1674
|
-
json: () => Promise.resolve(
|
|
2249
|
+
json: () => Promise.resolve(backendResponse)
|
|
1675
2250
|
});
|
|
1676
2251
|
const result = await graphClient.setObjects(req);
|
|
1677
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2252
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1678
2253
|
expect(result).toEqual(expected);
|
|
1679
2254
|
});
|
|
1680
2255
|
});
|