@@ -21,50 +21,88 @@ import {
2121} from '@/app/workspace/[workspaceId]/settings/navigation'
2222
2323describe ( 'unified settings navigation' , ( ) => {
24- it ( 'preserves the original settings groups ' , ( ) => {
24+ it ( 'groups settings by the scope they affect ' , ( ) => {
2525 expect ( sectionConfig ) . toEqual ( [
2626 { key : 'account' , title : 'Account' } ,
27- { key : 'tools' , title : 'Tools' } ,
28- { key : 'subscription' , title : 'Subscription' } ,
29- { key : 'system' , title : 'System' } ,
30- { key : 'desktop' , title : 'Desktop' } ,
31- { key : 'enterprise' , title : 'Enterprise' } ,
32- { key : 'superuser' , title : 'Superuser' } ,
27+ { key : 'workspace' , title : 'Workspace' } ,
28+ { key : 'organization' , title : 'Organization' } ,
29+ { key : 'platform' , title : 'Platform' } ,
3330 ] )
3431 } )
3532
3633 it ( 'keeps account, workspace, organization, and platform settings in one catalog' , ( ) => {
3734 expect ( allNavigationItems . map ( ( { id, label, section } ) => ( { id, label, section } ) ) ) . toEqual ( [
3835 { id : 'general' , label : 'General' , section : 'account' } ,
39- { id : 'desktop' , label : 'Desktop' , section : 'desktop ' } ,
40- { id : 'browser' , label : 'Browser' , section : 'desktop ' } ,
41- { id : 'terminal' , label : 'Terminal' , section : 'desktop ' } ,
42- { id : 'access-control' , label : 'Access control ' , section : 'enterprise ' } ,
43- { id : 'audit-logs' , label : 'Audit logs' , section : 'enterprise ' } ,
44- { id : 'forks' , label : 'Workspace Forks ' , section : 'enterprise ' } ,
45- { id : 'billing' , label : 'Billing ' , section : 'subscription ' } ,
46- { id : 'teammates' , label : 'Teammates' , section : 'subscription ' } ,
47- { id : 'organization' , label : 'Organization ' , section : 'subscription ' } ,
48- { id : 'secrets' , label : 'Secrets' , section : 'account ' } ,
49- { id : 'custom-tools' , label : 'Custom tools' , section : 'tools ' } ,
50- { id : 'mcp' , label : 'MCP tools' , section : 'tools ' } ,
51- { id : 'apikeys' , label : 'Sim API keys' , section : 'system ' } ,
52- { id : 'workflow-mcp-servers' , label : 'MCP servers' , section : 'system ' } ,
53- { id : 'byok' , label : 'BYOK' , section : 'system ' } ,
54- { id : 'sandboxes' , label : 'Sandboxes' , section : 'system ' } ,
55- { id : 'inbox' , label : 'Sim mailer ' , section : 'system ' } ,
56- { id : 'recently-deleted' , label : 'Recently deleted' , section : 'system ' } ,
57- { id : 'sso' , label : 'Single sign-on' , section : 'enterprise ' } ,
58- { id : 'sessions' , label : 'Session policies' , section : 'enterprise ' } ,
59- { id : 'data-retention' , label : 'Data retention' , section : 'enterprise ' } ,
60- { id : 'data-drains' , label : 'Data drains' , section : 'enterprise ' } ,
61- { id : 'whitelabeling' , label : 'Whitelabeling ' , section : 'enterprise ' } ,
62- { id : 'custom-blocks' , label : 'Custom blocks' , section : 'enterprise ' } ,
63- { id : 'admin' , label : 'Admin' , section : 'superuser ' } ,
64- { id : 'mothership' , label : 'Mothership' , section : 'superuser ' } ,
36+ { id : 'desktop' , label : 'Desktop' , section : 'account ' } ,
37+ { id : 'browser' , label : 'Browser' , section : 'account ' } ,
38+ { id : 'terminal' , label : 'Terminal' , section : 'account ' } ,
39+ { id : 'access-control' , label : 'Permission groups ' , section : 'organization ' } ,
40+ { id : 'audit-logs' , label : 'Audit logs' , section : 'organization ' } ,
41+ { id : 'forks' , label : 'Workspace forks ' , section : 'organization ' } ,
42+ { id : 'billing' , label : 'Subscription ' , section : 'account ' } ,
43+ { id : 'teammates' , label : 'Teammates' , section : 'workspace ' } ,
44+ { id : 'organization' , label : 'Members ' , section : 'organization ' } ,
45+ { id : 'secrets' , label : 'Secrets' , section : 'workspace ' } ,
46+ { id : 'custom-tools' , label : 'Custom tools' , section : 'workspace ' } ,
47+ { id : 'mcp' , label : 'MCP tools' , section : 'workspace ' } ,
48+ { id : 'apikeys' , label : 'Sim API keys' , section : 'workspace ' } ,
49+ { id : 'workflow-mcp-servers' , label : 'MCP servers' , section : 'workspace ' } ,
50+ { id : 'byok' , label : 'BYOK' , section : 'workspace ' } ,
51+ { id : 'sandboxes' , label : 'Sandboxes' , section : 'workspace ' } ,
52+ { id : 'inbox' , label : 'Sim Mailer ' , section : 'workspace ' } ,
53+ { id : 'recently-deleted' , label : 'Recently deleted' , section : 'workspace ' } ,
54+ { id : 'sso' , label : 'Single sign-on' , section : 'organization ' } ,
55+ { id : 'sessions' , label : 'Session policies' , section : 'organization ' } ,
56+ { id : 'data-retention' , label : 'Data retention' , section : 'organization ' } ,
57+ { id : 'data-drains' , label : 'Data drains' , section : 'organization ' } ,
58+ { id : 'whitelabeling' , label : 'White-labeling ' , section : 'organization ' } ,
59+ { id : 'custom-blocks' , label : 'Custom blocks' , section : 'organization ' } ,
60+ { id : 'admin' , label : 'Admin' , section : 'platform ' } ,
61+ { id : 'mothership' , label : 'Mothership' , section : 'platform ' } ,
6562 ] )
6663 } )
6764
65+ it ( 'orders each scope around its primary settings' , ( ) => {
66+ const idsForSection = ( section : ( typeof sectionConfig ) [ number ] [ 'key' ] ) =>
67+ allNavigationItems
68+ . filter ( ( item ) => item . section === section )
69+ . sort ( ( left , right ) => left . order - right . order )
70+ . map ( ( { id } ) => id )
71+
72+ expect ( idsForSection ( 'account' ) ) . toEqual ( [
73+ 'general' ,
74+ 'billing' ,
75+ 'desktop' ,
76+ 'browser' ,
77+ 'terminal' ,
78+ ] )
79+ expect ( idsForSection ( 'workspace' ) ) . toEqual ( [
80+ 'teammates' ,
81+ 'secrets' ,
82+ 'mcp' ,
83+ 'custom-tools' ,
84+ 'byok' ,
85+ 'inbox' ,
86+ 'workflow-mcp-servers' ,
87+ 'apikeys' ,
88+ 'sandboxes' ,
89+ 'recently-deleted' ,
90+ ] )
91+ expect ( idsForSection ( 'organization' ) ) . toEqual ( [
92+ 'organization' ,
93+ 'custom-blocks' ,
94+ 'forks' ,
95+ 'access-control' ,
96+ 'audit-logs' ,
97+ 'whitelabeling' ,
98+ 'sso' ,
99+ 'sessions' ,
100+ 'data-retention' ,
101+ 'data-drains' ,
102+ ] )
103+ expect ( idsForSection ( 'platform' ) ) . toEqual ( [ 'admin' , 'mothership' ] )
104+ } )
105+
68106 it ( 'derives every unified item from exactly one registry entry' , ( ) => {
69107 expect ( allNavigationItems ) . toHaveLength (
70108 SETTINGS_SECTION_REGISTRY . filter ( ( { unified } ) => unified ) . length
0 commit comments