@@ -12,6 +12,10 @@ import {useAddIntegration} from 'sentry/utils/integrations/useAddIntegration';
1212
1313describe ( 'useAddIntegration' , ( ) => {
1414 const provider = GitHubIntegrationProviderFixture ( ) ;
15+ const legacyProvider = GitHubIntegrationProviderFixture ( {
16+ key : 'custom_legacy' ,
17+ slug : 'custom_legacy' ,
18+ } ) ;
1519 const integration = GitHubIntegrationFixture ( ) ;
1620 let configState : Config ;
1721
@@ -58,7 +62,7 @@ describe('useAddIntegration', () => {
5862
5963 act ( ( ) =>
6064 result . current . startFlow ( {
61- provider,
65+ provider : legacyProvider ,
6266 organization : OrganizationFixture ( ) ,
6367 onInstall : jest . fn ( ) ,
6468 } )
@@ -76,7 +80,7 @@ describe('useAddIntegration', () => {
7680
7781 act ( ( ) =>
7882 result . current . startFlow ( {
79- provider,
83+ provider : legacyProvider ,
8084 organization : OrganizationFixture ( ) ,
8185 onInstall : jest . fn ( ) ,
8286 account : 'my-account' ,
@@ -96,7 +100,7 @@ describe('useAddIntegration', () => {
96100
97101 act ( ( ) =>
98102 result . current . startFlow ( {
99- provider,
103+ provider : legacyProvider ,
100104 organization : OrganizationFixture ( ) ,
101105 onInstall : jest . fn ( ) ,
102106 urlParams : { custom_param : 'value' } ,
@@ -114,7 +118,7 @@ describe('useAddIntegration', () => {
114118
115119 act ( ( ) =>
116120 result . current . startFlow ( {
117- provider,
121+ provider : legacyProvider ,
118122 organization : OrganizationFixture ( ) ,
119123 onInstall,
120124 } )
@@ -142,7 +146,7 @@ describe('useAddIntegration', () => {
142146
143147 act ( ( ) =>
144148 result . current . startFlow ( {
145- provider,
149+ provider : legacyProvider ,
146150 organization : OrganizationFixture ( ) ,
147151 onInstall : jest . fn ( ) ,
148152 } )
@@ -159,7 +163,7 @@ describe('useAddIntegration', () => {
159163
160164 act ( ( ) =>
161165 result . current . startFlow ( {
162- provider,
166+ provider : legacyProvider ,
163167 organization : OrganizationFixture ( ) ,
164168 onInstall : jest . fn ( ) ,
165169 } )
@@ -176,7 +180,7 @@ describe('useAddIntegration', () => {
176180
177181 act ( ( ) =>
178182 result . current . startFlow ( {
179- provider,
183+ provider : legacyProvider ,
180184 organization : OrganizationFixture ( ) ,
181185 onInstall : jest . fn ( ) ,
182186 } )
@@ -195,7 +199,7 @@ describe('useAddIntegration', () => {
195199
196200 act ( ( ) =>
197201 result . current . startFlow ( {
198- provider,
202+ provider : legacyProvider ,
199203 organization : OrganizationFixture ( ) ,
200204 onInstall,
201205 } )
@@ -212,6 +216,7 @@ describe('useAddIntegration', () => {
212216 await act ( async ( ) => {
213217 await new Promise ( resolve => setTimeout ( resolve , 50 ) ) ;
214218 } ) ;
219+
215220 expect ( onInstall ) . not . toHaveBeenCalled ( ) ;
216221 } ) ;
217222
@@ -222,7 +227,7 @@ describe('useAddIntegration', () => {
222227
223228 act ( ( ) =>
224229 result . current . startFlow ( {
225- provider,
230+ provider : legacyProvider ,
226231 organization : OrganizationFixture ( ) ,
227232 onInstall,
228233 } )
@@ -241,7 +246,7 @@ describe('useAddIntegration', () => {
241246
242247 act ( ( ) =>
243248 result . current . startFlow ( {
244- provider,
249+ provider : legacyProvider ,
245250 organization : OrganizationFixture ( ) ,
246251 onInstall : jest . fn ( ) ,
247252 } )
@@ -253,13 +258,11 @@ describe('useAddIntegration', () => {
253258 } ) ;
254259
255260 describe ( 'API pipeline flow' , ( ) => {
256- it ( 'opens the pipeline modal when feature flag is enabled ' , ( ) => {
261+ it ( 'opens the pipeline modal for unconditionally API-driven providers ' , ( ) => {
257262 const openPipelineModalSpy = jest . spyOn ( pipelineModal , 'openPipelineModal' ) ;
258263 const onInstall = jest . fn ( ) ;
259264
260- const organization = OrganizationFixture ( {
261- features : [ 'integration-api-pipeline-github' ] ,
262- } ) ;
265+ const organization = OrganizationFixture ( { features : [ ] } ) ;
263266
264267 const { result} = renderHookWithProviders ( ( ) => useAddIntegration ( ) ) ;
265268
@@ -282,9 +285,7 @@ describe('useAddIntegration', () => {
282285 it ( 'passes urlParams as initialData to the pipeline modal' , ( ) => {
283286 const openPipelineModalSpy = jest . spyOn ( pipelineModal , 'openPipelineModal' ) ;
284287
285- const organization = OrganizationFixture ( {
286- features : [ 'integration-api-pipeline-github' ] ,
287- } ) ;
288+ const organization = OrganizationFixture ( { features : [ ] } ) ;
288289
289290 const { result} = renderHookWithProviders ( ( ) => useAddIntegration ( ) ) ;
290291
@@ -308,9 +309,7 @@ describe('useAddIntegration', () => {
308309 jest . spyOn ( pipelineModal , 'openPipelineModal' ) ;
309310 jest . spyOn ( window , 'open' ) ;
310311
311- const organization = OrganizationFixture ( {
312- features : [ 'integration-api-pipeline-github' ] ,
313- } ) ;
312+ const organization = OrganizationFixture ( { features : [ ] } ) ;
314313
315314 const { result} = renderHookWithProviders ( ( ) => useAddIntegration ( ) ) ;
316315
@@ -325,7 +324,57 @@ describe('useAddIntegration', () => {
325324 expect ( window . open ) . not . toHaveBeenCalled ( ) ;
326325 } ) ;
327326
328- it ( 'falls back to legacy flow when feature flag is not enabled' , ( ) => {
327+ it ( 'opens the pipeline modal for other unconditional providers without a flag' , ( ) => {
328+ const openPipelineModalSpy = jest . spyOn ( pipelineModal , 'openPipelineModal' ) ;
329+ const organization = OrganizationFixture ( { features : [ ] } ) ;
330+ const gitlabProvider = GitHubIntegrationProviderFixture ( {
331+ key : 'gitlab' ,
332+ slug : 'gitlab' ,
333+ name : 'GitLab' ,
334+ } ) ;
335+
336+ const { result} = renderHookWithProviders ( ( ) => useAddIntegration ( ) ) ;
337+
338+ act ( ( ) =>
339+ result . current . startFlow ( {
340+ provider : gitlabProvider ,
341+ organization,
342+ onInstall : jest . fn ( ) ,
343+ } )
344+ ) ;
345+
346+ expect ( openPipelineModalSpy ) . toHaveBeenCalledWith (
347+ expect . objectContaining ( { provider : 'gitlab' } )
348+ ) ;
349+ } ) ;
350+
351+ it ( 'opens the pipeline modal for flagged rollout providers when the feature is enabled' , ( ) => {
352+ const openPipelineModalSpy = jest . spyOn ( pipelineModal , 'openPipelineModal' ) ;
353+ const organization = OrganizationFixture ( {
354+ features : [ 'integration-api-pipeline-vercel' ] ,
355+ } ) ;
356+ const vercelProvider = GitHubIntegrationProviderFixture ( {
357+ key : 'vercel' ,
358+ slug : 'vercel' ,
359+ name : 'Vercel' ,
360+ } ) ;
361+
362+ const { result} = renderHookWithProviders ( ( ) => useAddIntegration ( ) ) ;
363+
364+ act ( ( ) =>
365+ result . current . startFlow ( {
366+ provider : vercelProvider ,
367+ organization,
368+ onInstall : jest . fn ( ) ,
369+ } )
370+ ) ;
371+
372+ expect ( openPipelineModalSpy ) . toHaveBeenCalledWith (
373+ expect . objectContaining ( { provider : 'vercel' } )
374+ ) ;
375+ } ) ;
376+
377+ it ( 'falls back to legacy flow when the provider is not API driven' , ( ) => {
329378 const openPipelineModalSpy = jest . spyOn ( pipelineModal , 'openPipelineModal' ) ;
330379 jest
331380 . spyOn ( window , 'open' )
@@ -337,7 +386,7 @@ describe('useAddIntegration', () => {
337386
338387 act ( ( ) =>
339388 result . current . startFlow ( {
340- provider,
389+ provider : legacyProvider ,
341390 organization,
342391 onInstall : jest . fn ( ) ,
343392 } )
0 commit comments