@@ -24,8 +24,6 @@ vi.mock('@/lib/credential-groups/scoped-availability', () => ({
2424vi . mock ( '@/lib/credential-groups/search-connection-completion' , ( ) => ( {
2525 readSearchConnectionCompletion : m . completion ,
2626} ) )
27- vi . mock ( '@/lib/oauth/utils' , ( ) => ( { providerIdsForService : ( id : string ) => [ id ] } ) )
28-
2927vi . mock ( '@/lib/core/application/organization-authorization' , ( ) => ( {
3028 authorizeOrganizationOperation : m . authorize ,
3129} ) )
@@ -54,7 +52,7 @@ vi.mock('@/lib/integrations/availability.server', () => ({
5452vi . mock ( '@/lib/sim-search/connectors' , ( ) => ( {
5553 SEARCH_CONNECTORS : [ 'gmail' , 'slack' , 'notion' ] . map ( ( type ) => ( {
5654 type,
57- providerId : type ,
55+ providerId : type === 'gmail' ? 'google-email' : type ,
5856 meta : { name : type } ,
5957 setupFields : [ ] ,
6058 } ) ) ,
@@ -71,7 +69,7 @@ const principal = { kind: 'session', userId: 'person', sessionId: 'session' } as
7169const input = { organizationId : 'org' }
7270const target = {
7371 type : 'link' ,
74- provider : 'gmail ' ,
72+ provider : 'google-email ' ,
7573 connectorType : 'gmail' ,
7674 connectorId : 'source' ,
7775} as const
@@ -238,6 +236,42 @@ describe('live Search connection controls', () => {
238236 )
239237 } )
240238
239+ it ( 'offers Gmail when its Credential Group provider differs from its OAuth provider ID' , async ( ) => {
240+ m . group . mockResolvedValue ( {
241+ id : 'group' ,
242+ status : 'active' ,
243+ options : [
244+ { id : 'gmail-option' , provider : 'gmail' , status : 'active' , configurationStatus : 'ready' } ,
245+ ] ,
246+ } )
247+ m . accounts . mockResolvedValue ( [
248+ {
249+ optionId : 'gmail-option' ,
250+ credentialId : 'my-gmail' ,
251+ displayName : 'me@example.com' ,
252+ status : 'active' ,
253+ } ,
254+ ] )
255+
256+ const result = await listPersonalSearchIntegrations . execute ( { principal, input } )
257+ const addTarget = {
258+ type : 'link' ,
259+ provider : 'gmail' ,
260+ connectorType : 'gmail' ,
261+ connectionMode : 'live' ,
262+ optionId : 'gmail-option' ,
263+ }
264+ expect ( result . available ) . toEqual ( [ { name : 'gmail' , description : '' , target : addTarget } ] )
265+ expect ( result . connections [ 0 ] . accounts ) . toEqual ( [
266+ {
267+ credentialId : 'my-gmail' ,
268+ displayName : 'me@example.com' ,
269+ status : 'connected' ,
270+ action : { ...addTarget , credentialId : 'my-gmail' } ,
271+ } ,
272+ ] )
273+ } )
274+
241275 it ( 'keeps adding an account distinct from reconnecting an owned account' , async ( ) => {
242276 m . accounts . mockResolvedValue ( [
243277 { optionId : 'slack-option' , credentialId : 'mine' , displayName : 'My Slack' , status : 'active' } ,
0 commit comments