Files
supabase/apps/studio/components/interfaces/Integrations/Landing/useIntegrationDetail.utils.test.ts
Joshen Lim 0b9e8bdea4 Joshenlim/fe 4882 make the new integrations UI the default (#52683)
## Context

Makes the one-click integrations feature preview the new default +
cleans up all the old integrations code that's no longer used with this
change

## To test
- [ ] Verify that the project integrations page is using the new UI
2026-11-04 14:26:01 +08:00

50 lines
1.8 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import type { IntegrationDefinition } from '@/components/interfaces/Integrations/Landing/Integrations.constants'
import { getInstallActionType } from '@/components/interfaces/Integrations/Landing/useIntegrationDetail.utils'
// Minimal stubs — only fields exercised by the utils
const oauthIntegration = { id: 'github', type: 'oauth' } as unknown as IntegrationDefinition
const wrapperIntegration = {
id: 'stripe_wrapper',
type: 'wrapper',
} as unknown as IntegrationDefinition
const extensionIntegration = {
id: 'queues',
type: 'postgres_extension',
} as unknown as IntegrationDefinition
describe('getInstallActionType', () => {
it('returns null when integration is undefined', () => {
expect(getInstallActionType({ integration: undefined, isInstalled: false })).toBeNull()
})
it('returns "oauth" for OAuth integrations, installed or not', () => {
expect(getInstallActionType({ integration: oauthIntegration, isInstalled: false })).toBe(
'oauth'
)
expect(getInstallActionType({ integration: oauthIntegration, isInstalled: true })).toBe('oauth')
})
it('returns "add-wrapper" for wrappers, installed or not', () => {
expect(getInstallActionType({ integration: wrapperIntegration, isInstalled: false })).toBe(
'add-wrapper'
)
expect(getInstallActionType({ integration: wrapperIntegration, isInstalled: true })).toBe(
'add-wrapper'
)
})
it('returns "installed" for an installed non-wrapper integration', () => {
expect(getInstallActionType({ integration: extensionIntegration, isInstalled: true })).toBe(
'installed'
)
})
it('returns "install-sheet" for an uninstalled non-wrapper integration', () => {
expect(getInstallActionType({ integration: extensionIntegration, isInstalled: false })).toBe(
'install-sheet'
)
})
})