mirror of
https://github.com/supabase/supabase.git
synced 2026-10-17 15:19:08 +03:00
## What kind of change does this PR introduce? Impending feature addition. Resolves DEPR-340. ## What is the current behavior? We don’t have any platform webhook support. ## What is the new behavior? This puts the scaffolding for platform webhooks **behind a feature flag**. The content is currently UI-only (with mock data and a [temporary tracking file](https://github.com/supabase/supabase/blob/8adadc61f57c70b686a0f5f05e9f7f05837e0466/apps/studio/components/interfaces/Platform/Webhooks/DEPR-340-backend-integration-tracker.md)). Merging this in lets us work incrementally from here on.
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { describe, expect, it, vi } from 'vitest'
|
|
|
|
vi.mock('lib/constants', async () => {
|
|
const actual = await vi.importActual<Record<string, unknown>>('lib/constants')
|
|
return {
|
|
...actual,
|
|
IS_PLATFORM: true,
|
|
}
|
|
})
|
|
|
|
import { generateSettingsMenu } from './SettingsMenu.utils'
|
|
|
|
describe('generateSettingsMenu', () => {
|
|
it('includes webhooks in project settings items', () => {
|
|
const menu = generateSettingsMenu(
|
|
'project-ref',
|
|
{ status: 'ACTIVE_HEALTHY' } as any,
|
|
{ slug: 'my-org' } as any,
|
|
{ platformWebhooks: true }
|
|
)
|
|
|
|
const configurationGroup = menu.find((group) => group.title === 'Configuration')
|
|
const hasWebhooks = configurationGroup?.items.some(
|
|
(item) => item.name === 'Webhooks' && item.url === '/project/project-ref/settings/webhooks'
|
|
)
|
|
|
|
expect(hasWebhooks).toBe(true)
|
|
})
|
|
|
|
it('hides webhooks when platformWebhooks feature is disabled', () => {
|
|
const menu = generateSettingsMenu(
|
|
'project-ref',
|
|
{ status: 'ACTIVE_HEALTHY' } as any,
|
|
{ slug: 'my-org' } as any,
|
|
{ platformWebhooks: false }
|
|
)
|
|
|
|
const configurationGroup = menu.find((group) => group.title === 'Configuration')
|
|
const hasWebhooks = configurationGroup?.items.some((item) => item.name === 'Webhooks')
|
|
|
|
expect(hasWebhooks).toBe(false)
|
|
})
|
|
})
|