@@ -12,22 +12,7 @@ describe('groupEventDetails', () => {
12
12
let group ;
13
13
let event ;
14
14
15
- beforeEach ( ( ) => {
16
- const props = initializeOrg ( ) ;
17
- org = props . organization ;
18
- project = props . project ;
19
- project . organization = org ;
20
- routerContext = props . routerContext ;
21
-
22
- group = TestStubs . Group ( ) ;
23
- event = TestStubs . Event ( {
24
- size : 1 ,
25
- dateCreated : '2019-03-20T00:00:00.000Z' ,
26
- errors : [ ] ,
27
- entries : [ ] ,
28
- tags : [ { key : 'environment' , value : 'dev' } ] ,
29
- } ) ;
30
-
15
+ const mockGroupApis = ( ) => {
31
16
MockApiClient . addMockResponse ( {
32
17
url : `/issues/${ group . id } /` ,
33
18
body : group ,
@@ -67,12 +52,36 @@ describe('groupEventDetails', () => {
67
52
url : `/groups/${ group . id } /integrations/` ,
68
53
body : [ ] ,
69
54
} ) ;
55
+ } ;
56
+
57
+ beforeEach ( ( ) => {
58
+ const props = initializeOrg ( ) ;
59
+ org = props . organization ;
60
+ project = props . project ;
61
+ project . organization = org ;
62
+ routerContext = props . routerContext ;
63
+
64
+ group = TestStubs . Group ( ) ;
65
+ event = TestStubs . Event ( {
66
+ size : 1 ,
67
+ dateCreated : '2019-03-20T00:00:00.000Z' ,
68
+ errors : [ ] ,
69
+ entries : [ ] ,
70
+ tags : [ { key : 'environment' , value : 'dev' } ] ,
71
+ } ) ;
72
+
73
+ mockGroupApis ( ) ;
70
74
71
75
MockApiClient . addMockResponse ( {
72
76
url : '/sentry-apps/' ,
73
77
body : [ ] ,
74
78
} ) ;
75
79
80
+ MockApiClient . addMockResponse ( {
81
+ url : `/organizations/${ org . slug } /sentry-apps/` ,
82
+ body : [ ] ,
83
+ } ) ;
84
+
76
85
MockApiClient . addMockResponse ( {
77
86
url : `/organizations/${ org . slug } /sentry-app-installations/` ,
78
87
body : [ ] ,
@@ -195,51 +204,100 @@ describe('groupEventDetails', () => {
195
204
} ) ;
196
205
} ) ;
197
206
198
- it ( 'loads Sentry Apps' , ( ) => {
199
- const request = MockApiClient . addMockResponse ( {
200
- url : '/sentry-apps/' ,
201
- body : [ ] ,
207
+ describe ( 'Platform Integrations' , ( ) => {
208
+ let wrapper ; // eslint-disable-line
209
+ let integrationsRequest ;
210
+ let orgIntegrationsRequest ;
211
+ let componentsRequest ;
212
+
213
+ const mountWrapper = ( ) => {
214
+ return mount (
215
+ < GroupEventDetails
216
+ api = { new MockApiClient ( ) }
217
+ group = { group }
218
+ project = { project }
219
+ organization = { org }
220
+ environments = { [ { id : '1' , name : 'dev' , displayName : 'Dev' } ] }
221
+ params = { { orgId : org . slug , groupId : group . id , eventId : '1' } }
222
+ location = { { query : { environment : 'dev' } } }
223
+ /> ,
224
+ routerContext
225
+ ) ;
226
+ } ;
227
+
228
+ beforeEach ( ( ) => {
229
+ const integration = TestStubs . SentryApp ( ) ;
230
+ const unpublishedIntegration = TestStubs . SentryApp ( { status : 'unpublished' } ) ;
231
+ const internalIntegration = TestStubs . SentryApp ( { status : 'internal' } ) ;
232
+
233
+ const unpublishedInstall = TestStubs . SentryAppInstallation ( {
234
+ app : {
235
+ slug : unpublishedIntegration . slug ,
236
+ uuid : unpublishedIntegration . uuid ,
237
+ } ,
238
+ } ) ;
239
+
240
+ const internalInstall = TestStubs . SentryAppInstallation ( {
241
+ app : {
242
+ slug : internalIntegration . slug ,
243
+ uuid : internalIntegration . uuid ,
244
+ } ,
245
+ } ) ;
246
+
247
+ const component = TestStubs . SentryAppComponent ( {
248
+ sentryApp : {
249
+ uuid : unpublishedIntegration . uuid ,
250
+ slug : unpublishedIntegration . slug ,
251
+ name : unpublishedIntegration . name ,
252
+ } ,
253
+ } ) ;
254
+
255
+ MockApiClient . clearMockResponses ( ) ;
256
+ mockGroupApis ( ) ;
257
+
258
+ MockApiClient . addMockResponse ( {
259
+ url : `/projects/${ org . slug } /${ project . slug } /events/1/` ,
260
+ body : event ,
261
+ } ) ;
262
+
263
+ componentsRequest = MockApiClient . addMockResponse ( {
264
+ url : `/organizations/${ org . slug } /sentry-app-components/?projectId=${ project . id } ` ,
265
+ body : [ component ] ,
266
+ } ) ;
267
+
268
+ MockApiClient . addMockResponse ( {
269
+ url : `/projects/${ org . slug } /${ project . slug } /events/1/` ,
270
+ body : event ,
271
+ } ) ;
272
+
273
+ integrationsRequest = MockApiClient . addMockResponse ( {
274
+ url : '/sentry-apps/' ,
275
+ body : [ integration ] ,
276
+ } ) ;
277
+
278
+ MockApiClient . addMockResponse ( {
279
+ url : `/organizations/${ org . slug } /sentry-app-installations/` ,
280
+ body : [ unpublishedInstall , internalInstall ] ,
281
+ } ) ;
282
+
283
+ orgIntegrationsRequest = MockApiClient . addMockResponse ( {
284
+ url : `/organizations/${ org . slug } /sentry-apps/` ,
285
+ body : [ unpublishedIntegration , internalIntegration ] ,
286
+ } ) ;
287
+
288
+ wrapper = mountWrapper ( ) ;
202
289
} ) ;
203
290
204
- project . organization = org ;
205
-
206
- mount (
207
- < GroupEventDetails
208
- api = { new MockApiClient ( ) }
209
- group = { group }
210
- project = { project }
211
- organization = { org }
212
- environments = { [ { id : '1' , name : 'dev' , displayName : 'Dev' } ] }
213
- params = { { } }
214
- location = { { } }
215
- /> ,
216
- routerContext
217
- ) ;
218
-
219
- expect ( request ) . toHaveBeenCalledTimes ( 1 ) ;
220
- } ) ;
221
-
222
- it ( 'loads sentry app components when flagged in' , ( ) => {
223
- const request = MockApiClient . addMockResponse ( {
224
- url : `/organizations/${ org . slug } /sentry-app-components/?projectId=${ project . id } ` ,
225
- body : [ ] ,
291
+ it ( 'loads Integrations' , ( ) => {
292
+ expect ( integrationsRequest ) . toHaveBeenCalled ( ) ;
226
293
} ) ;
227
294
228
- project . organization = org ;
229
-
230
- mount (
231
- < GroupEventDetails
232
- api = { new MockApiClient ( ) }
233
- group = { group }
234
- project = { project }
235
- organization = { org }
236
- environments = { [ { id : '1' , name : 'dev' , displayName : 'Dev' } ] }
237
- params = { { } }
238
- location = { { } }
239
- /> ,
240
- routerContext
241
- ) ;
295
+ it ( 'loads unpublished and internal Integrations' , ( ) => {
296
+ expect ( orgIntegrationsRequest ) . toHaveBeenCalled ( ) ;
297
+ } ) ;
242
298
243
- expect ( request ) . toHaveBeenCalledTimes ( 1 ) ;
299
+ it ( 'loads Integration UI components' , ( ) => {
300
+ expect ( componentsRequest ) . toHaveBeenCalled ( ) ;
301
+ } ) ;
244
302
} ) ;
245
303
} ) ;
0 commit comments