Files
supabase/apps/studio/components/interfaces/ProjectHome/ActivityStats.test.tsx
Saxon Fletcher f9a1d2e983 Disable unsupported Studio features for HA projects (#48376)
## Summary

More gating to support upcoming High Availability projects. 

- Keep the Recent Branch stat visible on the project home page for HA
projects, but disable its interaction, reduce its opacity, and skip the
branches query.
- Treat Realtime as disabled for HA projects in the service-status
dropdown so it does not make the project appear unhealthy or trigger
unhealthy polling.
- Show the shared unsupported-feature empty state for Custom Domains and
skip its query on HA projects.
- Disable the Enable Realtime checkbox in the table creation sheet for
HA projects.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added High Availability–aware behavior across activity stats, service
status, custom domains, and table realtime controls.
- Introduced reusable Branch value UI that shows an “Unavailable” state
in High Availability mode.
- Added a dedicated realtime toggle UI that disables interaction and
updates helper text when unavailable.

- **Bug Fixes**
- Ensured realtime is treated as disabled (not unhealthy) in High
Availability and prevented realtime enabling/saving.
- Reduced unnecessary data fetching by gating addon/custom-domain
requests and disabling branch queries.

- **Tests**
- Added coverage for realtime status resolution, BranchStatValue
“Unavailable” rendering, and TableRealtimeToggle behavior.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-07-30 16:37:13 +08:00

23 lines
643 B
TypeScript

import { render, screen } from '@testing-library/react'
import { describe, expect, it } from 'vitest'
import { BranchStatValue } from './ActivityStats'
describe('BranchStatValue', () => {
it('shows branches as unavailable for HA projects without cached branch data', () => {
render(
<BranchStatValue
currentBranch={undefined}
isDefaultProject
isError={false}
isHighAvailability
isLoading
latestNonDefaultBranch={undefined}
/>
)
expect(screen.getByText('Unavailable')).toBeInTheDocument()
expect(screen.queryByText('No branches')).not.toBeInTheDocument()
})
})