mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 20:35:07 +03:00
- Updates connection pooling settings to be read-only when a high availability project with ip4 admonition removed - Updates organization usage to be disabled until supported - Updates database publications to be disabled until supported <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added High Availability handling for database publications, usage, and connection pooling. * Publications and usage now display dedicated “unavailable” empty states and hide gated content when High Availability is enabled. * Connection pooling switches to managed/read-only mode on High Availability, disabling edits and form submission and disabling related data fetching. * Pooling mode controls are hidden on High Availability. * **Refactor** * Refactored database publications pages by extracting main rendering logic into internal components. * **Tests** * Added Vitest + React Testing Library coverage for High Availability behavior across publications availability, usage, connection pooling, and pooling modes. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Alaister Young <10985857+alaister@users.noreply.github.com>
54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
import { render, screen } from '@testing-library/react'
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
import { PublicationsAvailability } from './PublicationsAvailability'
|
|
|
|
const { mockUseHighAvailability } = vi.hoisted(() => ({
|
|
mockUseHighAvailability: vi.fn(),
|
|
}))
|
|
|
|
vi.mock('@/hooks/misc/useHighAvailability', () => ({
|
|
useHighAvailability: mockUseHighAvailability,
|
|
}))
|
|
|
|
describe('PublicationsAvailability', () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks()
|
|
})
|
|
|
|
it('shows the disabled empty state instead of page content for High Availability projects', () => {
|
|
mockUseHighAvailability.mockReturnValue({ isHighAvailability: true })
|
|
|
|
render(
|
|
<PublicationsAvailability>
|
|
<div>Publications content</div>
|
|
</PublicationsAvailability>
|
|
)
|
|
|
|
expect(
|
|
screen.getByText('Publications unavailable on High Availability projects')
|
|
).toBeInTheDocument()
|
|
expect(
|
|
screen.getByText(
|
|
"We're working to bring publications to High Availability projects. Contact support if this is blocking your work."
|
|
)
|
|
).toBeInTheDocument()
|
|
expect(screen.queryByText('Publications content')).not.toBeInTheDocument()
|
|
})
|
|
|
|
it('renders page content for non-High Availability projects', () => {
|
|
mockUseHighAvailability.mockReturnValue({ isHighAvailability: false })
|
|
|
|
render(
|
|
<PublicationsAvailability>
|
|
<div>Publications content</div>
|
|
</PublicationsAvailability>
|
|
)
|
|
|
|
expect(screen.getByText('Publications content')).toBeInTheDocument()
|
|
expect(
|
|
screen.queryByText('Publications unavailable on High Availability projects')
|
|
).not.toBeInTheDocument()
|
|
})
|
|
})
|