mirror of
https://github.com/supabase/supabase.git
synced 2026-12-03 23:18:57 +00:00
## 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
50 lines
1.8 KiB
TypeScript
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'
|
|
)
|
|
})
|
|
})
|