@forge/teamwork-graph 2.2.0-next.2 → 2.2.0-next.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/out/__test__/entity-operations.test.js +452 -98
- package/out/__test__/error-handling.test.js +0 -1
- package/out/__test__/group-operations.test.js +31 -18
- package/out/__test__/user-operations.test.js +10 -3
- package/out/graph.d.ts.map +1 -1
- package/out/graph.js +37 -13
- package/out/types/objects/document.d.ts +1 -1
- package/out/types/requests.d.ts +75 -25
- package/out/types/requests.d.ts.map +1 -1
- package/out/utils/endpoints.d.ts +3 -3
- package/out/utils/endpoints.js +3 -3
- 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,26 +327,28 @@ describe('TeamWorkGraphClient - deleteObjectsByExternalId', () => {
|
|
|
291
327
|
jest.clearAllMocks();
|
|
292
328
|
});
|
|
293
329
|
it('should successfully delete objects in bulk', async () => {
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
{
|
|
298
|
-
{ externalId: 'pipelines/123/builds/789', success: true }
|
|
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' } }
|
|
299
334
|
]
|
|
300
335
|
};
|
|
336
|
+
const expectedResponse = {
|
|
337
|
+
success: true
|
|
338
|
+
};
|
|
301
339
|
mockFetch.mockResolvedValueOnce({
|
|
302
340
|
ok: true,
|
|
303
|
-
json: () => Promise.resolve(
|
|
341
|
+
json: () => Promise.resolve(backendResponse)
|
|
304
342
|
});
|
|
305
343
|
const result = await graphClient.deleteObjectsByExternalId({
|
|
306
344
|
objectType: 'atlassian:document',
|
|
307
345
|
externalIds: ['pipelines/123/builds/456', 'pipelines/123/builds/789']
|
|
308
346
|
});
|
|
309
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
347
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK_DELETE), {
|
|
310
348
|
method: 'DELETE',
|
|
311
349
|
body: JSON.stringify({
|
|
312
350
|
entityType: 'atlassian:document',
|
|
313
|
-
|
|
351
|
+
entityIds: ['pipelines/123/builds/456', 'pipelines/123/builds/789']
|
|
314
352
|
}),
|
|
315
353
|
redirect: 'follow',
|
|
316
354
|
headers: { 'Content-Type': 'application/json' }
|
|
@@ -368,7 +406,7 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
368
406
|
environment: 'staging',
|
|
369
407
|
status: 'failed'
|
|
370
408
|
});
|
|
371
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
409
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.DELETE_BY_PROPERTIES), {
|
|
372
410
|
method: 'DELETE',
|
|
373
411
|
body: JSON.stringify({
|
|
374
412
|
environment: 'staging',
|
|
@@ -395,7 +433,7 @@ describe('TeamWorkGraphClient - deleteObjectsByProperties', () => {
|
|
|
395
433
|
team: 'backend',
|
|
396
434
|
region: 'us-east-1'
|
|
397
435
|
});
|
|
398
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
436
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.DELETE_BY_PROPERTIES), {
|
|
399
437
|
method: 'DELETE',
|
|
400
438
|
body: JSON.stringify({
|
|
401
439
|
environment: 'production',
|
|
@@ -453,13 +491,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
453
491
|
'atlassian:branch': {}
|
|
454
492
|
};
|
|
455
493
|
const req = { objects: [branchObject] };
|
|
456
|
-
const
|
|
494
|
+
const backendResponse = {
|
|
495
|
+
accepted: [
|
|
496
|
+
{
|
|
497
|
+
entityType: 'atlassian:branch',
|
|
498
|
+
entityId: { id: 'branch-1' },
|
|
499
|
+
thirdPartyAri: 'ari:third-party:test::branch/branch-1'
|
|
500
|
+
}
|
|
501
|
+
]
|
|
502
|
+
};
|
|
503
|
+
const expected = {
|
|
504
|
+
success: true,
|
|
505
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
506
|
+
};
|
|
457
507
|
mockFetch.mockResolvedValueOnce({
|
|
458
508
|
ok: true,
|
|
459
|
-
json: () => Promise.resolve(
|
|
509
|
+
json: () => Promise.resolve(backendResponse)
|
|
460
510
|
});
|
|
461
511
|
const result = await graphClient.setObjects(req);
|
|
462
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
512
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
463
513
|
expect(result).toEqual(expected);
|
|
464
514
|
});
|
|
465
515
|
it('posts commit entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -499,13 +549,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
499
549
|
}
|
|
500
550
|
};
|
|
501
551
|
const req = { objects: [commitObject] };
|
|
502
|
-
const
|
|
552
|
+
const backendResponse = {
|
|
553
|
+
accepted: [
|
|
554
|
+
{
|
|
555
|
+
entityType: 'atlassian:commit',
|
|
556
|
+
entityId: { id: 'commit-1' },
|
|
557
|
+
thirdPartyAri: 'ari:third-party:test::commit/commit-1'
|
|
558
|
+
}
|
|
559
|
+
]
|
|
560
|
+
};
|
|
561
|
+
const expected = {
|
|
562
|
+
success: true,
|
|
563
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
564
|
+
};
|
|
503
565
|
mockFetch.mockResolvedValueOnce({
|
|
504
566
|
ok: true,
|
|
505
|
-
json: () => Promise.resolve(
|
|
567
|
+
json: () => Promise.resolve(backendResponse)
|
|
506
568
|
});
|
|
507
569
|
const result = await graphClient.setObjects(req);
|
|
508
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
570
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
509
571
|
expect(result).toEqual(expected);
|
|
510
572
|
});
|
|
511
573
|
it('posts build entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -557,13 +619,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
557
619
|
}
|
|
558
620
|
};
|
|
559
621
|
const req = { objects: [buildObject] };
|
|
560
|
-
const
|
|
622
|
+
const backendResponse = {
|
|
623
|
+
accepted: [
|
|
624
|
+
{
|
|
625
|
+
entityType: 'atlassian:build',
|
|
626
|
+
entityId: { id: 'build-1' },
|
|
627
|
+
thirdPartyAri: 'ari:third-party:test::build/build-1'
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
};
|
|
631
|
+
const expected = {
|
|
632
|
+
success: true,
|
|
633
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
634
|
+
};
|
|
561
635
|
mockFetch.mockResolvedValueOnce({
|
|
562
636
|
ok: true,
|
|
563
|
-
json: () => Promise.resolve(
|
|
637
|
+
json: () => Promise.resolve(backendResponse)
|
|
564
638
|
});
|
|
565
639
|
const result = await graphClient.setObjects(req);
|
|
566
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
640
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
567
641
|
expect(result).toEqual(expected);
|
|
568
642
|
});
|
|
569
643
|
it('posts calendar event entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -630,13 +704,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
630
704
|
}
|
|
631
705
|
};
|
|
632
706
|
const req = { objects: [calendarEventObject] };
|
|
633
|
-
const
|
|
707
|
+
const backendResponse = {
|
|
708
|
+
accepted: [
|
|
709
|
+
{
|
|
710
|
+
entityType: 'atlassian:calendar-event',
|
|
711
|
+
entityId: { id: 'calendar-event-1' },
|
|
712
|
+
thirdPartyAri: 'ari:third-party:test::calendar-event/calendar-event-1'
|
|
713
|
+
}
|
|
714
|
+
]
|
|
715
|
+
};
|
|
716
|
+
const expected = {
|
|
717
|
+
success: true,
|
|
718
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
719
|
+
};
|
|
634
720
|
mockFetch.mockResolvedValueOnce({
|
|
635
721
|
ok: true,
|
|
636
|
-
json: () => Promise.resolve(
|
|
722
|
+
json: () => Promise.resolve(backendResponse)
|
|
637
723
|
});
|
|
638
724
|
const result = await graphClient.setObjects(req);
|
|
639
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
725
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
640
726
|
expect(result).toEqual(expected);
|
|
641
727
|
});
|
|
642
728
|
it('posts comment entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -677,13 +763,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
677
763
|
}
|
|
678
764
|
};
|
|
679
765
|
const req = { objects: [commentObject] };
|
|
680
|
-
const
|
|
766
|
+
const backendResponse = {
|
|
767
|
+
accepted: [
|
|
768
|
+
{
|
|
769
|
+
entityType: 'atlassian:comment',
|
|
770
|
+
entityId: { id: 'comment-1' },
|
|
771
|
+
thirdPartyAri: 'ari:third-party:test::comment/comment-1'
|
|
772
|
+
}
|
|
773
|
+
]
|
|
774
|
+
};
|
|
775
|
+
const expected = {
|
|
776
|
+
success: true,
|
|
777
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
778
|
+
};
|
|
681
779
|
mockFetch.mockResolvedValueOnce({
|
|
682
780
|
ok: true,
|
|
683
|
-
json: () => Promise.resolve(
|
|
781
|
+
json: () => Promise.resolve(backendResponse)
|
|
684
782
|
});
|
|
685
783
|
const result = await graphClient.setObjects(req);
|
|
686
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
784
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
687
785
|
expect(result).toEqual(expected);
|
|
688
786
|
});
|
|
689
787
|
it('posts conversation entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -743,13 +841,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
743
841
|
}
|
|
744
842
|
};
|
|
745
843
|
const req = { objects: [conversationObject] };
|
|
746
|
-
const
|
|
844
|
+
const backendResponse = {
|
|
845
|
+
accepted: [
|
|
846
|
+
{
|
|
847
|
+
entityType: 'atlassian:conversation',
|
|
848
|
+
entityId: { id: 'conversation-1' },
|
|
849
|
+
thirdPartyAri: 'ari:third-party:test::conversation/conversation-1'
|
|
850
|
+
}
|
|
851
|
+
]
|
|
852
|
+
};
|
|
853
|
+
const expected = {
|
|
854
|
+
success: true,
|
|
855
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
856
|
+
};
|
|
747
857
|
mockFetch.mockResolvedValueOnce({
|
|
748
858
|
ok: true,
|
|
749
|
-
json: () => Promise.resolve(
|
|
859
|
+
json: () => Promise.resolve(backendResponse)
|
|
750
860
|
});
|
|
751
861
|
const result = await graphClient.setObjects(req);
|
|
752
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
862
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
753
863
|
expect(result).toEqual(expected);
|
|
754
864
|
});
|
|
755
865
|
it('posts customer org entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -818,13 +928,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
818
928
|
}
|
|
819
929
|
};
|
|
820
930
|
const req = { objects: [customerOrgObject] };
|
|
821
|
-
const
|
|
931
|
+
const backendResponse = {
|
|
932
|
+
accepted: [
|
|
933
|
+
{
|
|
934
|
+
entityType: 'atlassian:customer-org',
|
|
935
|
+
entityId: { id: 'customer-org-1' },
|
|
936
|
+
thirdPartyAri: 'ari:third-party:test::customer-org/customer-org-1'
|
|
937
|
+
}
|
|
938
|
+
]
|
|
939
|
+
};
|
|
940
|
+
const expected = {
|
|
941
|
+
success: true,
|
|
942
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
943
|
+
};
|
|
822
944
|
mockFetch.mockResolvedValueOnce({
|
|
823
945
|
ok: true,
|
|
824
|
-
json: () => Promise.resolve(
|
|
946
|
+
json: () => Promise.resolve(backendResponse)
|
|
825
947
|
});
|
|
826
948
|
const result = await graphClient.setObjects(req);
|
|
827
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
949
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
828
950
|
expect(result).toEqual(expected);
|
|
829
951
|
});
|
|
830
952
|
it('posts deal entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -893,13 +1015,21 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
893
1015
|
}
|
|
894
1016
|
};
|
|
895
1017
|
const req = { objects: [dealObject] };
|
|
896
|
-
const
|
|
1018
|
+
const backendResponse = {
|
|
1019
|
+
accepted: [
|
|
1020
|
+
{ entityType: 'atlassian:deal', entityId: { id: 'deal-1' }, thirdPartyAri: 'ari:third-party:test::deal/deal-1' }
|
|
1021
|
+
]
|
|
1022
|
+
};
|
|
1023
|
+
const expected = {
|
|
1024
|
+
success: true,
|
|
1025
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1026
|
+
};
|
|
897
1027
|
mockFetch.mockResolvedValueOnce({
|
|
898
1028
|
ok: true,
|
|
899
|
-
json: () => Promise.resolve(
|
|
1029
|
+
json: () => Promise.resolve(backendResponse)
|
|
900
1030
|
});
|
|
901
1031
|
const result = await graphClient.setObjects(req);
|
|
902
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1032
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
903
1033
|
expect(result).toEqual(expected);
|
|
904
1034
|
});
|
|
905
1035
|
it('posts deployment entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -964,13 +1094,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
964
1094
|
}
|
|
965
1095
|
};
|
|
966
1096
|
const req = { objects: [deploymentObject] };
|
|
967
|
-
const
|
|
1097
|
+
const backendResponse = {
|
|
1098
|
+
accepted: [
|
|
1099
|
+
{
|
|
1100
|
+
entityType: 'atlassian:deployment',
|
|
1101
|
+
entityId: { id: 'deployment-1' },
|
|
1102
|
+
thirdPartyAri: 'ari:third-party:test::deployment/deployment-1'
|
|
1103
|
+
}
|
|
1104
|
+
]
|
|
1105
|
+
};
|
|
1106
|
+
const expected = {
|
|
1107
|
+
success: true,
|
|
1108
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1109
|
+
};
|
|
968
1110
|
mockFetch.mockResolvedValueOnce({
|
|
969
1111
|
ok: true,
|
|
970
|
-
json: () => Promise.resolve(
|
|
1112
|
+
json: () => Promise.resolve(backendResponse)
|
|
971
1113
|
});
|
|
972
1114
|
const result = await graphClient.setObjects(req);
|
|
973
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1115
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
974
1116
|
expect(result).toEqual(expected);
|
|
975
1117
|
});
|
|
976
1118
|
it('posts design entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1005,13 +1147,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1005
1147
|
}
|
|
1006
1148
|
};
|
|
1007
1149
|
const req = { objects: [designObject] };
|
|
1008
|
-
const
|
|
1150
|
+
const backendResponse = {
|
|
1151
|
+
accepted: [
|
|
1152
|
+
{
|
|
1153
|
+
entityType: 'atlassian:design',
|
|
1154
|
+
entityId: { id: 'design-1' },
|
|
1155
|
+
thirdPartyAri: 'ari:third-party:test::design/design-1'
|
|
1156
|
+
}
|
|
1157
|
+
]
|
|
1158
|
+
};
|
|
1159
|
+
const expected = {
|
|
1160
|
+
success: true,
|
|
1161
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1162
|
+
};
|
|
1009
1163
|
mockFetch.mockResolvedValueOnce({
|
|
1010
1164
|
ok: true,
|
|
1011
|
-
json: () => Promise.resolve(
|
|
1165
|
+
json: () => Promise.resolve(backendResponse)
|
|
1012
1166
|
});
|
|
1013
1167
|
const result = await graphClient.setObjects(req);
|
|
1014
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1168
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1015
1169
|
expect(result).toEqual(expected);
|
|
1016
1170
|
});
|
|
1017
1171
|
it('posts position entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1057,13 +1211,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1057
1211
|
}
|
|
1058
1212
|
};
|
|
1059
1213
|
const req = { objects: [positionObject] };
|
|
1060
|
-
const
|
|
1214
|
+
const backendResponse = {
|
|
1215
|
+
accepted: [
|
|
1216
|
+
{
|
|
1217
|
+
entityType: 'atlassian:position',
|
|
1218
|
+
entityId: { id: 'position-1' },
|
|
1219
|
+
thirdPartyAri: 'ari:third-party:test::position/position-1'
|
|
1220
|
+
}
|
|
1221
|
+
]
|
|
1222
|
+
};
|
|
1223
|
+
const expected = {
|
|
1224
|
+
success: true,
|
|
1225
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1226
|
+
};
|
|
1061
1227
|
mockFetch.mockResolvedValueOnce({
|
|
1062
1228
|
ok: true,
|
|
1063
|
-
json: () => Promise.resolve(
|
|
1229
|
+
json: () => Promise.resolve(backendResponse)
|
|
1064
1230
|
});
|
|
1065
1231
|
const result = await graphClient.setObjects(req);
|
|
1066
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1232
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1067
1233
|
expect(result).toEqual(expected);
|
|
1068
1234
|
});
|
|
1069
1235
|
it('posts project entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1138,13 +1304,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1138
1304
|
}
|
|
1139
1305
|
};
|
|
1140
1306
|
const req = { objects: [projectObject] };
|
|
1141
|
-
const
|
|
1307
|
+
const backendResponse = {
|
|
1308
|
+
accepted: [
|
|
1309
|
+
{
|
|
1310
|
+
entityType: 'atlassian:project',
|
|
1311
|
+
entityId: { id: 'project-1' },
|
|
1312
|
+
thirdPartyAri: 'ari:third-party:test::project/project-1'
|
|
1313
|
+
}
|
|
1314
|
+
]
|
|
1315
|
+
};
|
|
1316
|
+
const expected = {
|
|
1317
|
+
success: true,
|
|
1318
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1319
|
+
};
|
|
1142
1320
|
mockFetch.mockResolvedValueOnce({
|
|
1143
1321
|
ok: true,
|
|
1144
|
-
json: () => Promise.resolve(
|
|
1322
|
+
json: () => Promise.resolve(backendResponse)
|
|
1145
1323
|
});
|
|
1146
1324
|
const result = await graphClient.setObjects(req);
|
|
1147
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1325
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1148
1326
|
expect(result).toEqual(expected);
|
|
1149
1327
|
});
|
|
1150
1328
|
it('posts pull request entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1220,13 +1398,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1220
1398
|
}
|
|
1221
1399
|
};
|
|
1222
1400
|
const req = { objects: [pullRequestObject] };
|
|
1223
|
-
const
|
|
1401
|
+
const backendResponse = {
|
|
1402
|
+
accepted: [
|
|
1403
|
+
{
|
|
1404
|
+
entityType: 'atlassian:pull-request',
|
|
1405
|
+
entityId: { id: 'pr-1' },
|
|
1406
|
+
thirdPartyAri: 'ari:third-party:test::pull-request/pr-1'
|
|
1407
|
+
}
|
|
1408
|
+
]
|
|
1409
|
+
};
|
|
1410
|
+
const expected = {
|
|
1411
|
+
success: true,
|
|
1412
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1413
|
+
};
|
|
1224
1414
|
mockFetch.mockResolvedValueOnce({
|
|
1225
1415
|
ok: true,
|
|
1226
|
-
json: () => Promise.resolve(
|
|
1416
|
+
json: () => Promise.resolve(backendResponse)
|
|
1227
1417
|
});
|
|
1228
1418
|
const result = await graphClient.setObjects(req);
|
|
1229
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1419
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1230
1420
|
expect(result).toEqual(expected);
|
|
1231
1421
|
});
|
|
1232
1422
|
it('posts remote link entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1286,13 +1476,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1286
1476
|
}
|
|
1287
1477
|
};
|
|
1288
1478
|
const req = { objects: [remoteLinkObject] };
|
|
1289
|
-
const
|
|
1479
|
+
const backendResponse = {
|
|
1480
|
+
accepted: [
|
|
1481
|
+
{
|
|
1482
|
+
entityType: 'atlassian:remote-link',
|
|
1483
|
+
entityId: { id: 'remote-link-1' },
|
|
1484
|
+
thirdPartyAri: 'ari:third-party:test::remote-link/remote-link-1'
|
|
1485
|
+
}
|
|
1486
|
+
]
|
|
1487
|
+
};
|
|
1488
|
+
const expected = {
|
|
1489
|
+
success: true,
|
|
1490
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1491
|
+
};
|
|
1290
1492
|
mockFetch.mockResolvedValueOnce({
|
|
1291
1493
|
ok: true,
|
|
1292
|
-
json: () => Promise.resolve(
|
|
1494
|
+
json: () => Promise.resolve(backendResponse)
|
|
1293
1495
|
});
|
|
1294
1496
|
const result = await graphClient.setObjects(req);
|
|
1295
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1497
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1296
1498
|
expect(result).toEqual(expected);
|
|
1297
1499
|
});
|
|
1298
1500
|
it('posts repository entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1325,13 +1527,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1325
1527
|
}
|
|
1326
1528
|
};
|
|
1327
1529
|
const req = { objects: [repositoryObject] };
|
|
1328
|
-
const
|
|
1530
|
+
const backendResponse = {
|
|
1531
|
+
accepted: [
|
|
1532
|
+
{
|
|
1533
|
+
entityType: 'atlassian:repository',
|
|
1534
|
+
entityId: { id: 'repository-1' },
|
|
1535
|
+
thirdPartyAri: 'ari:third-party:test::repository/repository-1'
|
|
1536
|
+
}
|
|
1537
|
+
]
|
|
1538
|
+
};
|
|
1539
|
+
const expected = {
|
|
1540
|
+
success: true,
|
|
1541
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1542
|
+
};
|
|
1329
1543
|
mockFetch.mockResolvedValueOnce({
|
|
1330
1544
|
ok: true,
|
|
1331
|
-
json: () => Promise.resolve(
|
|
1545
|
+
json: () => Promise.resolve(backendResponse)
|
|
1332
1546
|
});
|
|
1333
1547
|
const result = await graphClient.setObjects(req);
|
|
1334
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1548
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1335
1549
|
expect(result).toEqual(expected);
|
|
1336
1550
|
});
|
|
1337
1551
|
it('posts software service entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1373,13 +1587,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1373
1587
|
}
|
|
1374
1588
|
};
|
|
1375
1589
|
const req = { objects: [softwareServiceObject] };
|
|
1376
|
-
const
|
|
1590
|
+
const backendResponse = {
|
|
1591
|
+
accepted: [
|
|
1592
|
+
{
|
|
1593
|
+
entityType: 'atlassian:software-service',
|
|
1594
|
+
entityId: { id: 'software-service-1' },
|
|
1595
|
+
thirdPartyAri: 'ari:third-party:test::software-service/software-service-1'
|
|
1596
|
+
}
|
|
1597
|
+
]
|
|
1598
|
+
};
|
|
1599
|
+
const expected = {
|
|
1600
|
+
success: true,
|
|
1601
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1602
|
+
};
|
|
1377
1603
|
mockFetch.mockResolvedValueOnce({
|
|
1378
1604
|
ok: true,
|
|
1379
|
-
json: () => Promise.resolve(
|
|
1605
|
+
json: () => Promise.resolve(backendResponse)
|
|
1380
1606
|
});
|
|
1381
1607
|
const result = await graphClient.setObjects(req);
|
|
1382
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1608
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1383
1609
|
expect(result).toEqual(expected);
|
|
1384
1610
|
});
|
|
1385
1611
|
it('posts space entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1418,13 +1644,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1418
1644
|
}
|
|
1419
1645
|
};
|
|
1420
1646
|
const req = { objects: [spaceObject] };
|
|
1421
|
-
const
|
|
1647
|
+
const backendResponse = {
|
|
1648
|
+
accepted: [
|
|
1649
|
+
{
|
|
1650
|
+
entityType: 'atlassian:space',
|
|
1651
|
+
entityId: { id: 'space-1' },
|
|
1652
|
+
thirdPartyAri: 'ari:third-party:test::space/space-1'
|
|
1653
|
+
}
|
|
1654
|
+
]
|
|
1655
|
+
};
|
|
1656
|
+
const expected = {
|
|
1657
|
+
success: true,
|
|
1658
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1659
|
+
};
|
|
1422
1660
|
mockFetch.mockResolvedValueOnce({
|
|
1423
1661
|
ok: true,
|
|
1424
|
-
json: () => Promise.resolve(
|
|
1662
|
+
json: () => Promise.resolve(backendResponse)
|
|
1425
1663
|
});
|
|
1426
1664
|
const result = await graphClient.setObjects(req);
|
|
1427
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1665
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1428
1666
|
expect(result).toEqual(expected);
|
|
1429
1667
|
});
|
|
1430
1668
|
it('posts video entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1535,13 +1773,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1535
1773
|
}
|
|
1536
1774
|
};
|
|
1537
1775
|
const req = { objects: [videoObject] };
|
|
1538
|
-
const
|
|
1776
|
+
const backendResponse = {
|
|
1777
|
+
accepted: [
|
|
1778
|
+
{
|
|
1779
|
+
entityType: 'atlassian:video',
|
|
1780
|
+
entityId: { id: 'video-1' },
|
|
1781
|
+
thirdPartyAri: 'ari:third-party:test::video/video-1'
|
|
1782
|
+
}
|
|
1783
|
+
]
|
|
1784
|
+
};
|
|
1785
|
+
const expected = {
|
|
1786
|
+
success: true,
|
|
1787
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1788
|
+
};
|
|
1539
1789
|
mockFetch.mockResolvedValueOnce({
|
|
1540
1790
|
ok: true,
|
|
1541
|
-
json: () => Promise.resolve(
|
|
1791
|
+
json: () => Promise.resolve(backendResponse)
|
|
1542
1792
|
});
|
|
1543
1793
|
const result = await graphClient.setObjects(req);
|
|
1544
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1794
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1545
1795
|
expect(result).toEqual(expected);
|
|
1546
1796
|
});
|
|
1547
1797
|
it('posts work item entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1631,13 +1881,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1631
1881
|
}
|
|
1632
1882
|
};
|
|
1633
1883
|
const req = { objects: [workItemObject] };
|
|
1634
|
-
const
|
|
1884
|
+
const backendResponse = {
|
|
1885
|
+
accepted: [
|
|
1886
|
+
{
|
|
1887
|
+
entityType: 'atlassian:work-item',
|
|
1888
|
+
entityId: { id: 'work-item-1' },
|
|
1889
|
+
thirdPartyAri: 'ari:third-party:test::work-item/work-item-1'
|
|
1890
|
+
}
|
|
1891
|
+
]
|
|
1892
|
+
};
|
|
1893
|
+
const expected = {
|
|
1894
|
+
success: true,
|
|
1895
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1896
|
+
};
|
|
1635
1897
|
mockFetch.mockResolvedValueOnce({
|
|
1636
1898
|
ok: true,
|
|
1637
|
-
json: () => Promise.resolve(
|
|
1899
|
+
json: () => Promise.resolve(backendResponse)
|
|
1638
1900
|
});
|
|
1639
1901
|
const result = await graphClient.setObjects(req);
|
|
1640
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1902
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1641
1903
|
expect(result).toEqual(expected);
|
|
1642
1904
|
});
|
|
1643
1905
|
it('posts worker entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1678,13 +1940,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1678
1940
|
}
|
|
1679
1941
|
};
|
|
1680
1942
|
const req = { objects: [workerObject] };
|
|
1681
|
-
const
|
|
1943
|
+
const backendResponse = {
|
|
1944
|
+
accepted: [
|
|
1945
|
+
{
|
|
1946
|
+
entityType: 'atlassian:worker',
|
|
1947
|
+
entityId: { id: 'worker-1' },
|
|
1948
|
+
thirdPartyAri: 'ari:third-party:test::worker/worker-1'
|
|
1949
|
+
}
|
|
1950
|
+
]
|
|
1951
|
+
};
|
|
1952
|
+
const expected = {
|
|
1953
|
+
success: true,
|
|
1954
|
+
results: { accepted: backendResponse.accepted, rejected: undefined, validEntities: undefined }
|
|
1955
|
+
};
|
|
1682
1956
|
mockFetch.mockResolvedValueOnce({
|
|
1683
1957
|
ok: true,
|
|
1684
|
-
json: () => Promise.resolve(
|
|
1958
|
+
json: () => Promise.resolve(backendResponse)
|
|
1685
1959
|
});
|
|
1686
1960
|
const result = await graphClient.setObjects(req);
|
|
1687
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1961
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1688
1962
|
expect(result).toEqual(expected);
|
|
1689
1963
|
});
|
|
1690
1964
|
it('posts dashboard entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1723,13 +1997,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1723
1997
|
}
|
|
1724
1998
|
};
|
|
1725
1999
|
const req = { objects: [dashboardObject] };
|
|
1726
|
-
const
|
|
2000
|
+
const backendResponse = {
|
|
2001
|
+
accepted: [
|
|
2002
|
+
{
|
|
2003
|
+
entityType: 'atlassian:dashboard',
|
|
2004
|
+
entityId: { id: 'dashboard-1' },
|
|
2005
|
+
thirdPartyAri: 'ari:third-party:test::dashboard/dashboard-1'
|
|
2006
|
+
}
|
|
2007
|
+
]
|
|
2008
|
+
};
|
|
2009
|
+
const expected = {
|
|
2010
|
+
success: true,
|
|
2011
|
+
results: {
|
|
2012
|
+
accepted: backendResponse.accepted,
|
|
2013
|
+
rejected: undefined,
|
|
2014
|
+
validEntities: undefined
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
1727
2017
|
mockFetch.mockResolvedValueOnce({
|
|
1728
2018
|
ok: true,
|
|
1729
|
-
json: () => Promise.resolve(
|
|
2019
|
+
json: () => Promise.resolve(backendResponse)
|
|
1730
2020
|
});
|
|
1731
2021
|
const result = await graphClient.setObjects(req);
|
|
1732
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2022
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1733
2023
|
expect(result).toEqual(expected);
|
|
1734
2024
|
});
|
|
1735
2025
|
it('posts test entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1764,13 +2054,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1764
2054
|
}
|
|
1765
2055
|
};
|
|
1766
2056
|
const req = { objects: [testObject] };
|
|
1767
|
-
const
|
|
2057
|
+
const backendResponse = {
|
|
2058
|
+
accepted: [
|
|
2059
|
+
{
|
|
2060
|
+
entityType: 'atlassian:test',
|
|
2061
|
+
entityId: { id: 'test-1' },
|
|
2062
|
+
thirdPartyAri: 'ari:third-party:test::test/test-1'
|
|
2063
|
+
}
|
|
2064
|
+
]
|
|
2065
|
+
};
|
|
2066
|
+
const expected = {
|
|
2067
|
+
success: true,
|
|
2068
|
+
results: {
|
|
2069
|
+
accepted: backendResponse.accepted,
|
|
2070
|
+
rejected: undefined,
|
|
2071
|
+
validEntities: undefined
|
|
2072
|
+
}
|
|
2073
|
+
};
|
|
1768
2074
|
mockFetch.mockResolvedValueOnce({
|
|
1769
2075
|
ok: true,
|
|
1770
|
-
json: () => Promise.resolve(
|
|
2076
|
+
json: () => Promise.resolve(backendResponse)
|
|
1771
2077
|
});
|
|
1772
2078
|
const result = await graphClient.setObjects(req);
|
|
1773
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2079
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1774
2080
|
expect(result).toEqual(expected);
|
|
1775
2081
|
});
|
|
1776
2082
|
it('posts test execution entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1803,13 +2109,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1803
2109
|
}
|
|
1804
2110
|
};
|
|
1805
2111
|
const req = { objects: [testExecutionObject] };
|
|
1806
|
-
const
|
|
2112
|
+
const backendResponse = {
|
|
2113
|
+
accepted: [
|
|
2114
|
+
{
|
|
2115
|
+
entityType: 'atlassian:test-execution',
|
|
2116
|
+
entityId: { id: 'test-execution-1' },
|
|
2117
|
+
thirdPartyAri: 'ari:third-party:test::test-execution/test-execution-1'
|
|
2118
|
+
}
|
|
2119
|
+
]
|
|
2120
|
+
};
|
|
2121
|
+
const expected = {
|
|
2122
|
+
success: true,
|
|
2123
|
+
results: {
|
|
2124
|
+
accepted: backendResponse.accepted,
|
|
2125
|
+
rejected: undefined,
|
|
2126
|
+
validEntities: undefined
|
|
2127
|
+
}
|
|
2128
|
+
};
|
|
1807
2129
|
mockFetch.mockResolvedValueOnce({
|
|
1808
2130
|
ok: true,
|
|
1809
|
-
json: () => Promise.resolve(
|
|
2131
|
+
json: () => Promise.resolve(backendResponse)
|
|
1810
2132
|
});
|
|
1811
2133
|
const result = await graphClient.setObjects(req);
|
|
1812
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2134
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1813
2135
|
expect(result).toEqual(expected);
|
|
1814
2136
|
});
|
|
1815
2137
|
it('posts test plan entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1838,13 +2160,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1838
2160
|
'atlassian:test-plan': {}
|
|
1839
2161
|
};
|
|
1840
2162
|
const req = { objects: [testPlanObject] };
|
|
1841
|
-
const
|
|
2163
|
+
const backendResponse = {
|
|
2164
|
+
accepted: [
|
|
2165
|
+
{
|
|
2166
|
+
entityType: 'atlassian:test-plan',
|
|
2167
|
+
entityId: { id: 'test-plan-1' },
|
|
2168
|
+
thirdPartyAri: 'ari:third-party:test::test-plan/test-plan-1'
|
|
2169
|
+
}
|
|
2170
|
+
]
|
|
2171
|
+
};
|
|
2172
|
+
const expected = {
|
|
2173
|
+
success: true,
|
|
2174
|
+
results: {
|
|
2175
|
+
accepted: backendResponse.accepted,
|
|
2176
|
+
rejected: undefined,
|
|
2177
|
+
validEntities: undefined
|
|
2178
|
+
}
|
|
2179
|
+
};
|
|
1842
2180
|
mockFetch.mockResolvedValueOnce({
|
|
1843
2181
|
ok: true,
|
|
1844
|
-
json: () => Promise.resolve(
|
|
2182
|
+
json: () => Promise.resolve(backendResponse)
|
|
1845
2183
|
});
|
|
1846
2184
|
const result = await graphClient.setObjects(req);
|
|
1847
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2185
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1848
2186
|
expect(result).toEqual(expected);
|
|
1849
2187
|
});
|
|
1850
2188
|
it('posts test run entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1888,13 +2226,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1888
2226
|
}
|
|
1889
2227
|
};
|
|
1890
2228
|
const req = { objects: [testRunObject] };
|
|
1891
|
-
const
|
|
2229
|
+
const backendResponse = {
|
|
2230
|
+
accepted: [
|
|
2231
|
+
{
|
|
2232
|
+
entityType: 'atlassian:test-run',
|
|
2233
|
+
entityId: { id: 'test-run-1' },
|
|
2234
|
+
thirdPartyAri: 'ari:third-party:test::test-run/test-run-1'
|
|
2235
|
+
}
|
|
2236
|
+
]
|
|
2237
|
+
};
|
|
2238
|
+
const expected = {
|
|
2239
|
+
success: true,
|
|
2240
|
+
results: {
|
|
2241
|
+
accepted: backendResponse.accepted,
|
|
2242
|
+
rejected: undefined,
|
|
2243
|
+
validEntities: undefined
|
|
2244
|
+
}
|
|
2245
|
+
};
|
|
1892
2246
|
mockFetch.mockResolvedValueOnce({
|
|
1893
2247
|
ok: true,
|
|
1894
|
-
json: () => Promise.resolve(
|
|
2248
|
+
json: () => Promise.resolve(backendResponse)
|
|
1895
2249
|
});
|
|
1896
2250
|
const result = await graphClient.setObjects(req);
|
|
1897
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2251
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1898
2252
|
expect(result).toEqual(expected);
|
|
1899
2253
|
});
|
|
1900
2254
|
});
|