Skip to content

Commit 71d8330

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(oci): align authorization regression coverage
1 parent 84fe75a commit 71d8330

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

‎apps/sim/app/api/auth/oauth/token/route.test.ts‎

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,23 @@ describe('OAuth Token API Routes', () => {
328328
describe('service account path', () => {
329329
it('threads the NetSuite SuiteTalk instance URL into the token response', async () => {
330330
const instanceUrl = 'https://1234567.suitetalk.api.netsuite.com'
331-
authOAuthUtilsMockFns.mockResolveOAuthAccountId.mockResolvedValueOnce({
331+
const resolvedCredential = {
332332
accountId: '',
333333
credentialId: 'netsuite-credential-id',
334334
credentialType: 'service_account',
335335
providerId: 'netsuite-service-account',
336336
workspaceId: 'workspace-id',
337337
usedCredentialTable: true,
338-
})
338+
} as const
339+
authOAuthUtilsMockFns.mockResolveOAuthAccountId
340+
.mockResolvedValueOnce(resolvedCredential)
341+
.mockResolvedValueOnce(resolvedCredential)
339342
mockAuthorizeCredentialUse.mockResolvedValueOnce({
340343
ok: true,
341344
authType: 'session',
342345
requesterUserId: 'test-user-id',
343346
workspaceId: 'workspace-id',
347+
resolvedCredentialId: 'netsuite-credential-id',
344348
})
345349
mockResolveServiceAccountToken.mockResolvedValueOnce({
346350
accessToken: 'netsuite-token',
@@ -357,19 +361,23 @@ describe('OAuth Token API Routes', () => {
357361
})
358362

359363
it('should thread authStyle from the resolver into the response', async () => {
360-
authOAuthUtilsMockFns.mockResolveOAuthAccountId.mockResolvedValueOnce({
364+
const resolvedCredential = {
361365
accountId: '',
362366
credentialId: 'sa-credential-id',
363367
credentialType: 'service_account',
364368
providerId: 'pipedrive-service-account',
365369
workspaceId: 'workspace-id',
366370
usedCredentialTable: true,
367-
})
371+
} as const
372+
authOAuthUtilsMockFns.mockResolveOAuthAccountId
373+
.mockResolvedValueOnce(resolvedCredential)
374+
.mockResolvedValueOnce(resolvedCredential)
368375
mockAuthorizeCredentialUse.mockResolvedValueOnce({
369376
ok: true,
370377
authType: 'session',
371378
requesterUserId: 'test-user-id',
372379
workspaceId: 'workspace-id',
380+
resolvedCredentialId: 'sa-credential-id',
373381
})
374382
mockResolveServiceAccountToken.mockResolvedValueOnce({
375383
accessToken: 'pasted-api-token',
@@ -387,19 +395,23 @@ describe('OAuth Token API Routes', () => {
387395
})
388396

389397
it('should omit authStyle for Bearer token-paste providers', async () => {
390-
authOAuthUtilsMockFns.mockResolveOAuthAccountId.mockResolvedValueOnce({
398+
const resolvedCredential = {
391399
accountId: '',
392400
credentialId: 'sa-credential-id',
393401
credentialType: 'service_account',
394402
providerId: 'hubspot-service-account',
395403
workspaceId: 'workspace-id',
396404
usedCredentialTable: true,
397-
})
405+
} as const
406+
authOAuthUtilsMockFns.mockResolveOAuthAccountId
407+
.mockResolvedValueOnce(resolvedCredential)
408+
.mockResolvedValueOnce(resolvedCredential)
398409
mockAuthorizeCredentialUse.mockResolvedValueOnce({
399410
ok: true,
400411
authType: 'session',
401412
requesterUserId: 'test-user-id',
402413
workspaceId: 'workspace-id',
414+
resolvedCredentialId: 'sa-credential-id',
403415
})
404416
mockResolveServiceAccountToken.mockResolvedValueOnce({
405417
accessToken: 'pat-token',
@@ -422,19 +434,23 @@ describe('OAuth Token API Routes', () => {
422434
] as const)(
423435
'surfaces the %s error code with status %i when the mint fails',
424436
async (code, status) => {
425-
authOAuthUtilsMockFns.mockResolveOAuthAccountId.mockResolvedValueOnce({
437+
const resolvedCredential = {
426438
accountId: '',
427439
credentialId: 'sa-credential-id',
428440
credentialType: 'service_account',
429441
providerId: 'salesforce-service-account',
430442
workspaceId: 'workspace-id',
431443
usedCredentialTable: true,
432-
})
444+
} as const
445+
authOAuthUtilsMockFns.mockResolveOAuthAccountId
446+
.mockResolvedValueOnce(resolvedCredential)
447+
.mockResolvedValueOnce(resolvedCredential)
433448
mockAuthorizeCredentialUse.mockResolvedValueOnce({
434449
ok: true,
435450
authType: 'session',
436451
requesterUserId: 'test-user-id',
437452
workspaceId: 'workspace-id',
453+
resolvedCredentialId: 'sa-credential-id',
438454
})
439455
mockResolveServiceAccountToken.mockRejectedValueOnce(
440456
new TokenServiceAccountValidationError(code, status, { step: 'mint' })

‎apps/sim/lib/integrations/credential-display.test.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ const EXPECTED_COVERAGE: Record<string, string[]> = {
6565
'linear-service-account': ['linear'],
6666
'monday-service-account': ['monday'],
6767
'notion-service-account': ['notion'],
68+
// OCI owns reusable credential setup but intentionally exposes no product
69+
// integration until a native OCI product supplies visible catalog metadata.
70+
'oci-api-key-service-account': [],
6871
// NetSuite remains an API-key catalog integration, like Snowflake, while its
6972
// block uses the shared reusable-credential selector.
7073
'netsuite-service-account': [],

0 commit comments

Comments
 (0)