@@ -123,8 +123,7 @@ describe('OrganizationLayout', () => {
123123 { } ,
124124 'org-1' ,
125125 { kind : 'session' , userId : 'viewer-1' , sessionId : 'session-1' } ,
126- 'active-org' ,
127- true
126+ 'active-org'
128127 )
129128 expect ( html ) . toContain ( 'Organization child' )
130129 expect ( mockUseMothershipChatEvents ) . toHaveBeenCalledWith (
@@ -159,15 +158,14 @@ describe('OrganizationLayout', () => {
159158 { } ,
160159 'org-1' ,
161160 { kind : 'session' , userId : 'viewer-1' , sessionId : 'session-1' } ,
162- null ,
163- true
161+ null
164162 )
165163 expect ( html ) . toContain ( 'Impersonating QA Member (member@example.com)' )
166164 expect ( html ) . toContain ( 'Stop impersonating' )
167165 expect ( html . indexOf ( 'Stop impersonating' ) ) . toBeLessThan ( html . indexOf ( 'Organization child' ) )
168166 } )
169167
170- it ( 'uses the impersonated member to open settings when Search is disabled ' , async ( ) => {
168+ it ( 'does not use the impersonating admin to enter an organization outside the rollout ' , async ( ) => {
171169 mockGetSession . mockResolvedValue ( {
172170 user : { id : 'customer-member' } ,
173171 session : { id : 'session-1' , impersonatedBy : 'platform-admin' } ,
@@ -177,24 +175,18 @@ describe('OrganizationLayout', () => {
177175 searchAccess : { memberScoped : false , sourceMirrored : false } ,
178176 } )
179177
180- const html = renderToStaticMarkup (
181- await OrganizationLayout ( {
178+ await expect (
179+ OrganizationLayout ( {
182180 children : < div > Organization child</ div > ,
183181 params : Promise . resolve ( { organizationId : 'customer-org' } ) ,
184182 } )
185- )
183+ ) . rejects . toThrow ( 'redirect:/workspace?redirect=settings' )
186184 expect ( mockGetOrganizationSurfaceContext ) . toHaveBeenCalledWith (
187185 'customer-org' ,
188186 'customer-member'
189187 )
190- expect ( html ) . toContain ( 'Organization child' )
191- expect ( mockPrefetchOrganizationSidebar ) . toHaveBeenCalledWith (
192- { } ,
193- 'customer-org' ,
194- { kind : 'session' , userId : 'customer-member' , sessionId : 'session-1' } ,
195- null ,
196- false
197- )
188+ expect ( mockWorkspaceChrome ) . not . toHaveBeenCalled ( )
189+ expect ( mockPrefetchOrganizationSidebar ) . not . toHaveBeenCalled ( )
198190 } )
199191
200192 it ( 'renders an explicit denial for a non-member without the surface' , async ( ) => {
@@ -213,32 +205,22 @@ describe('OrganizationLayout', () => {
213205 } )
214206
215207 it . each ( [ 'owner' , 'admin' , 'member' ] ) (
216- 'renders organization settings for a %s when Search is disabled ' ,
208+ 'returns %s viewers outside the rollout to workspace settings before rendering org chrome ' ,
217209 async ( role ) => {
218210 mockGetOrganizationSurfaceContext . mockResolvedValue ( {
219211 ...SURFACE_CONTEXT ,
220212 viewer : { role, isAdmin : role !== 'member' } ,
221213 searchAccess : { memberScoped : false , sourceMirrored : true } ,
222214 } )
223215
224- const html = renderToStaticMarkup (
225- await OrganizationLayout ( {
216+ await expect (
217+ OrganizationLayout ( {
226218 children : < div > Organization settings</ div > ,
227219 params : Promise . resolve ( { organizationId : 'org-1' } ) ,
228220 } )
229- )
230- expect ( html ) . toContain ( 'Organization settings' )
231- expect ( mockPrefetchOrganizationSidebar ) . toHaveBeenCalledWith (
232- { } ,
233- 'org-1' ,
234- { kind : 'session' , userId : 'viewer-1' , sessionId : 'session-1' } ,
235- 'active-org' ,
236- false
237- )
238- expect ( mockUseMothershipChatEvents ) . toHaveBeenCalledWith (
239- undefined ,
240- SURFACE_CONTEXT . deployment . chatEnabled
241- )
221+ ) . rejects . toThrow ( 'redirect:/workspace?redirect=settings' )
222+ expect ( mockWorkspaceChrome ) . not . toHaveBeenCalled ( )
223+ expect ( mockPrefetchOrganizationSidebar ) . not . toHaveBeenCalled ( )
242224 }
243225 )
244226
0 commit comments