@@ -8,6 +8,64 @@ import type { Integration } from '@/lib/integrations/types'
88
99const INTEGRATIONS = integrationsJson . integrations as readonly Integration [ ]
1010
11+ /**
12+ * Pinned slug → OAuth providerId mapping for every OAuth integration in the
13+ * catalog. Guards against silent drift between block `serviceId`s, the
14+ * generated catalog, and `OAUTH_PROVIDERS` — the failure mode that made
15+ * Jira Service Management, Google Slides, and Monday fall back to the
16+ * API-key connect path.
17+ */
18+ const EXPECTED_PROVIDER_BY_SLUG : Record < string , string > = {
19+ airtable : 'airtable' ,
20+ asana : 'asana' ,
21+ attio : 'attio' ,
22+ 'azure-ad' : 'microsoft-ad' ,
23+ box : 'box' ,
24+ 'cal-com' : 'calcom' ,
25+ confluence : 'confluence' ,
26+ docusign : 'docusign' ,
27+ dropbox : 'dropbox' ,
28+ gmail : 'google-email' ,
29+ 'google-ads' : 'google-ads' ,
30+ 'google-bigquery' : 'google-bigquery' ,
31+ 'google-calendar' : 'google-calendar' ,
32+ 'google-contacts' : 'google-contacts' ,
33+ 'google-docs' : 'google-docs' ,
34+ 'google-drive' : 'google-drive' ,
35+ 'google-forms' : 'google-forms' ,
36+ 'google-groups' : 'google-groups' ,
37+ 'google-meet' : 'google-meet' ,
38+ 'google-sheets' : 'google-sheets' ,
39+ 'google-slides' : 'google-drive' ,
40+ 'google-tasks' : 'google-tasks' ,
41+ 'google-vault' : 'google-vault' ,
42+ hubspot : 'hubspot' ,
43+ jira : 'jira' ,
44+ 'jira-service-management' : 'jira' ,
45+ linear : 'linear' ,
46+ linkedin : 'linkedin' ,
47+ 'microsoft-dataverse' : 'microsoft-dataverse' ,
48+ 'microsoft-excel' : 'microsoft-excel' ,
49+ 'microsoft-planner' : 'microsoft-planner' ,
50+ 'microsoft-teams' : 'microsoft-teams' ,
51+ monday : 'monday' ,
52+ notion : 'notion' ,
53+ onedrive : 'onedrive' ,
54+ outlook : 'outlook' ,
55+ pipedrive : 'pipedrive' ,
56+ reddit : 'reddit' ,
57+ salesforce : 'salesforce' ,
58+ sharepoint : 'sharepoint' ,
59+ shopify : 'shopify' ,
60+ slack : 'slack' ,
61+ trello : 'trello' ,
62+ wealthbox : 'wealthbox' ,
63+ webflow : 'webflow' ,
64+ wordpress : 'wordpress' ,
65+ x : 'x' ,
66+ zoom : 'zoom' ,
67+ }
68+
1169describe ( 'resolveOAuthServiceForSlug' , ( ) => {
1270 it . concurrent ( 'resolves integrations whose name differs from the OAuth service name' , ( ) => {
1371 const jsm = resolveOAuthServiceForSlug ( 'jira-service-management' )
@@ -49,4 +107,25 @@ describe('resolveOAuthServiceForSlug', () => {
49107 . map ( ( entry ) => entry . slug )
50108 expect ( unresolved ) . toEqual ( [ ] )
51109 } )
110+
111+ it . concurrent ( 'resolves the pinned provider for every enumerated OAuth integration' , ( ) => {
112+ const resolved = Object . fromEntries (
113+ Object . keys ( EXPECTED_PROVIDER_BY_SLUG ) . map ( ( slug ) => [
114+ slug ,
115+ resolveOAuthServiceForSlug ( slug ) ?. providerId ?? null ,
116+ ] )
117+ )
118+ expect ( resolved ) . toEqual ( EXPECTED_PROVIDER_BY_SLUG )
119+ } )
120+
121+ it . concurrent ( 'carries oauthServiceId for exactly the OAuth catalog entries' , ( ) => {
122+ const missing = INTEGRATIONS . filter (
123+ ( entry ) => entry . authType === 'oauth' && ! entry . oauthServiceId
124+ ) . map ( ( entry ) => entry . slug )
125+ const unexpected = INTEGRATIONS . filter (
126+ ( entry ) => entry . authType !== 'oauth' && entry . oauthServiceId
127+ ) . map ( ( entry ) => entry . slug )
128+ expect ( missing ) . toEqual ( [ ] )
129+ expect ( unexpected ) . toEqual ( [ ] )
130+ } )
52131} )
0 commit comments