@forge/teamwork-graph 2.2.0-next.2 → 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 +451 -96
- 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/document.d.ts +1 -1
- 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',
|
|
@@ -453,13 +492,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
453
492
|
'atlassian:branch': {}
|
|
454
493
|
};
|
|
455
494
|
const req = { objects: [branchObject] };
|
|
456
|
-
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
|
+
};
|
|
457
508
|
mockFetch.mockResolvedValueOnce({
|
|
458
509
|
ok: true,
|
|
459
|
-
json: () => Promise.resolve(
|
|
510
|
+
json: () => Promise.resolve(backendResponse)
|
|
460
511
|
});
|
|
461
512
|
const result = await graphClient.setObjects(req);
|
|
462
|
-
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' }));
|
|
463
514
|
expect(result).toEqual(expected);
|
|
464
515
|
});
|
|
465
516
|
it('posts commit entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -499,13 +550,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
499
550
|
}
|
|
500
551
|
};
|
|
501
552
|
const req = { objects: [commitObject] };
|
|
502
|
-
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
|
+
};
|
|
503
566
|
mockFetch.mockResolvedValueOnce({
|
|
504
567
|
ok: true,
|
|
505
|
-
json: () => Promise.resolve(
|
|
568
|
+
json: () => Promise.resolve(backendResponse)
|
|
506
569
|
});
|
|
507
570
|
const result = await graphClient.setObjects(req);
|
|
508
|
-
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' }));
|
|
509
572
|
expect(result).toEqual(expected);
|
|
510
573
|
});
|
|
511
574
|
it('posts build entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -557,13 +620,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
557
620
|
}
|
|
558
621
|
};
|
|
559
622
|
const req = { objects: [buildObject] };
|
|
560
|
-
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
|
+
};
|
|
561
636
|
mockFetch.mockResolvedValueOnce({
|
|
562
637
|
ok: true,
|
|
563
|
-
json: () => Promise.resolve(
|
|
638
|
+
json: () => Promise.resolve(backendResponse)
|
|
564
639
|
});
|
|
565
640
|
const result = await graphClient.setObjects(req);
|
|
566
|
-
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' }));
|
|
567
642
|
expect(result).toEqual(expected);
|
|
568
643
|
});
|
|
569
644
|
it('posts calendar event entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -630,13 +705,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
630
705
|
}
|
|
631
706
|
};
|
|
632
707
|
const req = { objects: [calendarEventObject] };
|
|
633
|
-
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
|
+
};
|
|
634
721
|
mockFetch.mockResolvedValueOnce({
|
|
635
722
|
ok: true,
|
|
636
|
-
json: () => Promise.resolve(
|
|
723
|
+
json: () => Promise.resolve(backendResponse)
|
|
637
724
|
});
|
|
638
725
|
const result = await graphClient.setObjects(req);
|
|
639
|
-
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' }));
|
|
640
727
|
expect(result).toEqual(expected);
|
|
641
728
|
});
|
|
642
729
|
it('posts comment entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -677,13 +764,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
677
764
|
}
|
|
678
765
|
};
|
|
679
766
|
const req = { objects: [commentObject] };
|
|
680
|
-
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
|
+
};
|
|
681
780
|
mockFetch.mockResolvedValueOnce({
|
|
682
781
|
ok: true,
|
|
683
|
-
json: () => Promise.resolve(
|
|
782
|
+
json: () => Promise.resolve(backendResponse)
|
|
684
783
|
});
|
|
685
784
|
const result = await graphClient.setObjects(req);
|
|
686
|
-
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' }));
|
|
687
786
|
expect(result).toEqual(expected);
|
|
688
787
|
});
|
|
689
788
|
it('posts conversation entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -743,13 +842,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
743
842
|
}
|
|
744
843
|
};
|
|
745
844
|
const req = { objects: [conversationObject] };
|
|
746
|
-
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
|
+
};
|
|
747
858
|
mockFetch.mockResolvedValueOnce({
|
|
748
859
|
ok: true,
|
|
749
|
-
json: () => Promise.resolve(
|
|
860
|
+
json: () => Promise.resolve(backendResponse)
|
|
750
861
|
});
|
|
751
862
|
const result = await graphClient.setObjects(req);
|
|
752
|
-
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' }));
|
|
753
864
|
expect(result).toEqual(expected);
|
|
754
865
|
});
|
|
755
866
|
it('posts customer org entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -818,13 +929,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
818
929
|
}
|
|
819
930
|
};
|
|
820
931
|
const req = { objects: [customerOrgObject] };
|
|
821
|
-
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
|
+
};
|
|
822
945
|
mockFetch.mockResolvedValueOnce({
|
|
823
946
|
ok: true,
|
|
824
|
-
json: () => Promise.resolve(
|
|
947
|
+
json: () => Promise.resolve(backendResponse)
|
|
825
948
|
});
|
|
826
949
|
const result = await graphClient.setObjects(req);
|
|
827
|
-
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' }));
|
|
828
951
|
expect(result).toEqual(expected);
|
|
829
952
|
});
|
|
830
953
|
it('posts deal entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -893,13 +1016,21 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
893
1016
|
}
|
|
894
1017
|
};
|
|
895
1018
|
const req = { objects: [dealObject] };
|
|
896
|
-
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
|
+
};
|
|
897
1028
|
mockFetch.mockResolvedValueOnce({
|
|
898
1029
|
ok: true,
|
|
899
|
-
json: () => Promise.resolve(
|
|
1030
|
+
json: () => Promise.resolve(backendResponse)
|
|
900
1031
|
});
|
|
901
1032
|
const result = await graphClient.setObjects(req);
|
|
902
|
-
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' }));
|
|
903
1034
|
expect(result).toEqual(expected);
|
|
904
1035
|
});
|
|
905
1036
|
it('posts deployment entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -964,13 +1095,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
964
1095
|
}
|
|
965
1096
|
};
|
|
966
1097
|
const req = { objects: [deploymentObject] };
|
|
967
|
-
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
|
+
};
|
|
968
1111
|
mockFetch.mockResolvedValueOnce({
|
|
969
1112
|
ok: true,
|
|
970
|
-
json: () => Promise.resolve(
|
|
1113
|
+
json: () => Promise.resolve(backendResponse)
|
|
971
1114
|
});
|
|
972
1115
|
const result = await graphClient.setObjects(req);
|
|
973
|
-
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' }));
|
|
974
1117
|
expect(result).toEqual(expected);
|
|
975
1118
|
});
|
|
976
1119
|
it('posts design entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1005,13 +1148,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1005
1148
|
}
|
|
1006
1149
|
};
|
|
1007
1150
|
const req = { objects: [designObject] };
|
|
1008
|
-
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
|
+
};
|
|
1009
1164
|
mockFetch.mockResolvedValueOnce({
|
|
1010
1165
|
ok: true,
|
|
1011
|
-
json: () => Promise.resolve(
|
|
1166
|
+
json: () => Promise.resolve(backendResponse)
|
|
1012
1167
|
});
|
|
1013
1168
|
const result = await graphClient.setObjects(req);
|
|
1014
|
-
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' }));
|
|
1015
1170
|
expect(result).toEqual(expected);
|
|
1016
1171
|
});
|
|
1017
1172
|
it('posts position entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1057,13 +1212,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1057
1212
|
}
|
|
1058
1213
|
};
|
|
1059
1214
|
const req = { objects: [positionObject] };
|
|
1060
|
-
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
|
+
};
|
|
1061
1228
|
mockFetch.mockResolvedValueOnce({
|
|
1062
1229
|
ok: true,
|
|
1063
|
-
json: () => Promise.resolve(
|
|
1230
|
+
json: () => Promise.resolve(backendResponse)
|
|
1064
1231
|
});
|
|
1065
1232
|
const result = await graphClient.setObjects(req);
|
|
1066
|
-
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' }));
|
|
1067
1234
|
expect(result).toEqual(expected);
|
|
1068
1235
|
});
|
|
1069
1236
|
it('posts project entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1138,13 +1305,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1138
1305
|
}
|
|
1139
1306
|
};
|
|
1140
1307
|
const req = { objects: [projectObject] };
|
|
1141
|
-
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
|
+
};
|
|
1142
1321
|
mockFetch.mockResolvedValueOnce({
|
|
1143
1322
|
ok: true,
|
|
1144
|
-
json: () => Promise.resolve(
|
|
1323
|
+
json: () => Promise.resolve(backendResponse)
|
|
1145
1324
|
});
|
|
1146
1325
|
const result = await graphClient.setObjects(req);
|
|
1147
|
-
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' }));
|
|
1148
1327
|
expect(result).toEqual(expected);
|
|
1149
1328
|
});
|
|
1150
1329
|
it('posts pull request entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1220,13 +1399,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1220
1399
|
}
|
|
1221
1400
|
};
|
|
1222
1401
|
const req = { objects: [pullRequestObject] };
|
|
1223
|
-
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
|
+
};
|
|
1224
1415
|
mockFetch.mockResolvedValueOnce({
|
|
1225
1416
|
ok: true,
|
|
1226
|
-
json: () => Promise.resolve(
|
|
1417
|
+
json: () => Promise.resolve(backendResponse)
|
|
1227
1418
|
});
|
|
1228
1419
|
const result = await graphClient.setObjects(req);
|
|
1229
|
-
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' }));
|
|
1230
1421
|
expect(result).toEqual(expected);
|
|
1231
1422
|
});
|
|
1232
1423
|
it('posts remote link entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1286,13 +1477,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1286
1477
|
}
|
|
1287
1478
|
};
|
|
1288
1479
|
const req = { objects: [remoteLinkObject] };
|
|
1289
|
-
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
|
+
};
|
|
1290
1493
|
mockFetch.mockResolvedValueOnce({
|
|
1291
1494
|
ok: true,
|
|
1292
|
-
json: () => Promise.resolve(
|
|
1495
|
+
json: () => Promise.resolve(backendResponse)
|
|
1293
1496
|
});
|
|
1294
1497
|
const result = await graphClient.setObjects(req);
|
|
1295
|
-
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' }));
|
|
1296
1499
|
expect(result).toEqual(expected);
|
|
1297
1500
|
});
|
|
1298
1501
|
it('posts repository entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1325,13 +1528,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1325
1528
|
}
|
|
1326
1529
|
};
|
|
1327
1530
|
const req = { objects: [repositoryObject] };
|
|
1328
|
-
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
|
+
};
|
|
1329
1544
|
mockFetch.mockResolvedValueOnce({
|
|
1330
1545
|
ok: true,
|
|
1331
|
-
json: () => Promise.resolve(
|
|
1546
|
+
json: () => Promise.resolve(backendResponse)
|
|
1332
1547
|
});
|
|
1333
1548
|
const result = await graphClient.setObjects(req);
|
|
1334
|
-
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' }));
|
|
1335
1550
|
expect(result).toEqual(expected);
|
|
1336
1551
|
});
|
|
1337
1552
|
it('posts software service entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1373,13 +1588,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1373
1588
|
}
|
|
1374
1589
|
};
|
|
1375
1590
|
const req = { objects: [softwareServiceObject] };
|
|
1376
|
-
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
|
+
};
|
|
1377
1604
|
mockFetch.mockResolvedValueOnce({
|
|
1378
1605
|
ok: true,
|
|
1379
|
-
json: () => Promise.resolve(
|
|
1606
|
+
json: () => Promise.resolve(backendResponse)
|
|
1380
1607
|
});
|
|
1381
1608
|
const result = await graphClient.setObjects(req);
|
|
1382
|
-
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' }));
|
|
1383
1610
|
expect(result).toEqual(expected);
|
|
1384
1611
|
});
|
|
1385
1612
|
it('posts space entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1418,13 +1645,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1418
1645
|
}
|
|
1419
1646
|
};
|
|
1420
1647
|
const req = { objects: [spaceObject] };
|
|
1421
|
-
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
|
+
};
|
|
1422
1661
|
mockFetch.mockResolvedValueOnce({
|
|
1423
1662
|
ok: true,
|
|
1424
|
-
json: () => Promise.resolve(
|
|
1663
|
+
json: () => Promise.resolve(backendResponse)
|
|
1425
1664
|
});
|
|
1426
1665
|
const result = await graphClient.setObjects(req);
|
|
1427
|
-
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' }));
|
|
1428
1667
|
expect(result).toEqual(expected);
|
|
1429
1668
|
});
|
|
1430
1669
|
it('posts video entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1535,13 +1774,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1535
1774
|
}
|
|
1536
1775
|
};
|
|
1537
1776
|
const req = { objects: [videoObject] };
|
|
1538
|
-
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
|
+
};
|
|
1539
1790
|
mockFetch.mockResolvedValueOnce({
|
|
1540
1791
|
ok: true,
|
|
1541
|
-
json: () => Promise.resolve(
|
|
1792
|
+
json: () => Promise.resolve(backendResponse)
|
|
1542
1793
|
});
|
|
1543
1794
|
const result = await graphClient.setObjects(req);
|
|
1544
|
-
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' }));
|
|
1545
1796
|
expect(result).toEqual(expected);
|
|
1546
1797
|
});
|
|
1547
1798
|
it('posts work item entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1631,13 +1882,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1631
1882
|
}
|
|
1632
1883
|
};
|
|
1633
1884
|
const req = { objects: [workItemObject] };
|
|
1634
|
-
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
|
+
};
|
|
1635
1898
|
mockFetch.mockResolvedValueOnce({
|
|
1636
1899
|
ok: true,
|
|
1637
|
-
json: () => Promise.resolve(
|
|
1900
|
+
json: () => Promise.resolve(backendResponse)
|
|
1638
1901
|
});
|
|
1639
1902
|
const result = await graphClient.setObjects(req);
|
|
1640
|
-
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' }));
|
|
1641
1904
|
expect(result).toEqual(expected);
|
|
1642
1905
|
});
|
|
1643
1906
|
it('posts worker entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1678,13 +1941,25 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1678
1941
|
}
|
|
1679
1942
|
};
|
|
1680
1943
|
const req = { objects: [workerObject] };
|
|
1681
|
-
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
|
+
};
|
|
1682
1957
|
mockFetch.mockResolvedValueOnce({
|
|
1683
1958
|
ok: true,
|
|
1684
|
-
json: () => Promise.resolve(
|
|
1959
|
+
json: () => Promise.resolve(backendResponse)
|
|
1685
1960
|
});
|
|
1686
1961
|
const result = await graphClient.setObjects(req);
|
|
1687
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
1962
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1688
1963
|
expect(result).toEqual(expected);
|
|
1689
1964
|
});
|
|
1690
1965
|
it('posts dashboard entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1723,13 +1998,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1723
1998
|
}
|
|
1724
1999
|
};
|
|
1725
2000
|
const req = { objects: [dashboardObject] };
|
|
1726
|
-
const
|
|
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
|
+
};
|
|
1727
2018
|
mockFetch.mockResolvedValueOnce({
|
|
1728
2019
|
ok: true,
|
|
1729
|
-
json: () => Promise.resolve(
|
|
2020
|
+
json: () => Promise.resolve(backendResponse)
|
|
1730
2021
|
});
|
|
1731
2022
|
const result = await graphClient.setObjects(req);
|
|
1732
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2023
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1733
2024
|
expect(result).toEqual(expected);
|
|
1734
2025
|
});
|
|
1735
2026
|
it('posts test entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1764,13 +2055,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1764
2055
|
}
|
|
1765
2056
|
};
|
|
1766
2057
|
const req = { objects: [testObject] };
|
|
1767
|
-
const
|
|
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
|
+
};
|
|
1768
2075
|
mockFetch.mockResolvedValueOnce({
|
|
1769
2076
|
ok: true,
|
|
1770
|
-
json: () => Promise.resolve(
|
|
2077
|
+
json: () => Promise.resolve(backendResponse)
|
|
1771
2078
|
});
|
|
1772
2079
|
const result = await graphClient.setObjects(req);
|
|
1773
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2080
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1774
2081
|
expect(result).toEqual(expected);
|
|
1775
2082
|
});
|
|
1776
2083
|
it('posts test execution entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1803,13 +2110,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1803
2110
|
}
|
|
1804
2111
|
};
|
|
1805
2112
|
const req = { objects: [testExecutionObject] };
|
|
1806
|
-
const
|
|
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
|
+
};
|
|
1807
2130
|
mockFetch.mockResolvedValueOnce({
|
|
1808
2131
|
ok: true,
|
|
1809
|
-
json: () => Promise.resolve(
|
|
2132
|
+
json: () => Promise.resolve(backendResponse)
|
|
1810
2133
|
});
|
|
1811
2134
|
const result = await graphClient.setObjects(req);
|
|
1812
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2135
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1813
2136
|
expect(result).toEqual(expected);
|
|
1814
2137
|
});
|
|
1815
2138
|
it('posts test plan entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1838,13 +2161,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1838
2161
|
'atlassian:test-plan': {}
|
|
1839
2162
|
};
|
|
1840
2163
|
const req = { objects: [testPlanObject] };
|
|
1841
|
-
const
|
|
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
|
+
};
|
|
1842
2181
|
mockFetch.mockResolvedValueOnce({
|
|
1843
2182
|
ok: true,
|
|
1844
|
-
json: () => Promise.resolve(
|
|
2183
|
+
json: () => Promise.resolve(backendResponse)
|
|
1845
2184
|
});
|
|
1846
2185
|
const result = await graphClient.setObjects(req);
|
|
1847
|
-
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.
|
|
2186
|
+
expect(mockFetch).toHaveBeenCalledWith((0, endpoints_1.getFullPath)(endpoints_1.ENDPOINTS.OBJECTS.BULK), expect.objectContaining({ method: 'POST' }));
|
|
1848
2187
|
expect(result).toEqual(expected);
|
|
1849
2188
|
});
|
|
1850
2189
|
it('posts test run entities to /api/v1/entities/bulk and returns response', async () => {
|
|
@@ -1888,13 +2227,29 @@ describe('TeamWorkGraphClient - bulk entities', () => {
|
|
|
1888
2227
|
}
|
|
1889
2228
|
};
|
|
1890
2229
|
const req = { objects: [testRunObject] };
|
|
1891
|
-
const
|
|
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
|
+
};
|
|
1892
2247
|
mockFetch.mockResolvedValueOnce({
|
|
1893
2248
|
ok: true,
|
|
1894
|
-
json: () => Promise.resolve(
|
|
2249
|
+
json: () => Promise.resolve(backendResponse)
|
|
1895
2250
|
});
|
|
1896
2251
|
const result = await graphClient.setObjects(req);
|
|
1897
|
-
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' }));
|
|
1898
2253
|
expect(result).toEqual(expected);
|
|
1899
2254
|
});
|
|
1900
2255
|
});
|