Files
supabase/apps/studio/components/layouts/ProjectLayout/OrganizationSettingsLayout.test.ts
T
Danny White 706207436f chore(studio): move organization settings nav to sidebar layout (#43228)
## What kind of change does this PR introduce?

UI change

## What is the current behavior?

Organization settings are currently spread across a NavMenu. This is
getting unweildy as the amount of children within Organization settings
grows.

## What is the new behavior?

Organization settings are now on a sidebar, just like Project Settings
and most other surfaces.

| Before | After |
| --- | --- |
| <img width="1024" height="563" alt="Supabase"
src="https://github.com/user-attachments/assets/3889858c-157a-4deb-8714-71fe9cf002e6"
/> | <img width="1024" height="563" alt="General Supabase"
src="https://github.com/user-attachments/assets/1b4eb2c3-a67c-4eda-ab3c-e6610dd5ccf4"
/> |

## Additional context

@fsansalvadore and the design team have have other efforts going on to
reduce interface clutter, e.g. nested sidebars.
2026-03-03 10:15:40 +11:00

83 lines
2.5 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
generateOrganizationSettingsSections,
getOrganizationSettingsDocumentTitle,
normalizeOrganizationSettingsPath,
} from './OrganizationSettingsLayout'
describe('OrganizationSettingsLayout helpers', () => {
it('returns expected organization settings sections and links', () => {
const sections = generateOrganizationSettingsSections({
slug: 'my-org',
currentPath: '/org/my-org/general',
showSecuritySettings: true,
showSsoSettings: true,
showLegalDocuments: true,
})
expect(sections.map((section) => section.heading)).toEqual([
'Configuration',
'Connections',
'Compliance',
])
expect(sections.flatMap((section) => section.links.map((item) => item.label))).toEqual([
'General',
'Security',
'SSO',
'OAuth Apps',
'Audit Logs',
'Legal Documents',
])
expect(
sections.flatMap((section) => section.links).find((item) => item.label === 'General')
?.isActive
).toBe(true)
})
it('hides feature-flagged items when flags are disabled', () => {
const sections = generateOrganizationSettingsSections({
slug: 'my-org',
currentPath: '/org/my-org/general',
showSecuritySettings: false,
showSsoSettings: false,
showLegalDocuments: false,
})
expect(sections.map((section) => section.heading)).toEqual([
'Configuration',
'Connections',
'Compliance',
])
expect(sections.flatMap((section) => section.links.map((item) => item.label))).toEqual([
'General',
'OAuth Apps',
'Audit Logs',
])
})
it('normalizes hash paths for active state checks', () => {
const currentPath = normalizeOrganizationSettingsPath('/org/my-org/security#sso')
const sections = generateOrganizationSettingsSections({
slug: 'my-org',
currentPath,
showSecuritySettings: true,
showSsoSettings: true,
showLegalDocuments: true,
})
expect(
sections.flatMap((section) => section.links).find((item) => item.label === 'Security')
?.isActive
).toBe(true)
})
it('uses settings as default document title when page title is not provided', () => {
expect(getOrganizationSettingsDocumentTitle(undefined, 'Supabase')).toBe('Settings | Supabase')
})
it('uses page title for document title when provided', () => {
expect(getOrganizationSettingsDocumentTitle('General', 'Supabase')).toBe('General | Supabase')
})
})