@@ -123,7 +123,8 @@ describe('OrganizationLayout', () => {
123123 { } ,
124124 'org-1' ,
125125 { kind : 'session' , userId : 'viewer-1' , sessionId : 'session-1' } ,
126- 'active-org'
126+ 'active-org' ,
127+ true
127128 )
128129 expect ( html ) . toContain ( 'Organization child' )
129130 expect ( mockUseMothershipChatEvents ) . toHaveBeenCalledWith (
@@ -158,14 +159,15 @@ describe('OrganizationLayout', () => {
158159 { } ,
159160 'org-1' ,
160161 { kind : 'session' , userId : 'viewer-1' , sessionId : 'session-1' } ,
161- null
162+ null ,
163+ true
162164 )
163165 expect ( html ) . toContain ( 'Impersonating QA Member (member@example.com)' )
164166 expect ( html ) . toContain ( 'Stop impersonating' )
165167 expect ( html . indexOf ( 'Stop impersonating' ) ) . toBeLessThan ( html . indexOf ( 'Organization child' ) )
166168 } )
167169
168- it ( 'does not use the impersonating admin to enter an organization outside the rollout ' , async ( ) => {
170+ it ( 'uses the impersonated member to open settings when Search is disabled ' , async ( ) => {
169171 mockGetSession . mockResolvedValue ( {
170172 user : { id : 'customer-member' } ,
171173 session : { id : 'session-1' , impersonatedBy : 'platform-admin' } ,
@@ -175,18 +177,24 @@ describe('OrganizationLayout', () => {
175177 searchAccess : { memberScoped : false , sourceMirrored : false } ,
176178 } )
177179
178- await expect (
179- OrganizationLayout ( {
180+ const html = renderToStaticMarkup (
181+ await OrganizationLayout ( {
180182 children : < div > Organization child</ div > ,
181183 params : Promise . resolve ( { organizationId : 'customer-org' } ) ,
182184 } )
183- ) . rejects . toThrow ( 'redirect:/workspace?redirect=settings' )
185+ )
184186 expect ( mockGetOrganizationSurfaceContext ) . toHaveBeenCalledWith (
185187 'customer-org' ,
186188 'customer-member'
187189 )
188- expect ( mockWorkspaceChrome ) . not . toHaveBeenCalled ( )
189- expect ( mockPrefetchOrganizationSidebar ) . not . toHaveBeenCalled ( )
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+ )
190198 } )
191199
192200 it ( 'renders an explicit denial for a non-member without the surface' , async ( ) => {
@@ -205,22 +213,32 @@ describe('OrganizationLayout', () => {
205213 } )
206214
207215 it . each ( [ 'owner' , 'admin' , 'member' ] ) (
208- 'returns %s viewers outside the rollout to workspace settings before rendering org chrome ' ,
216+ 'renders organization settings for a %s when Search is disabled ' ,
209217 async ( role ) => {
210218 mockGetOrganizationSurfaceContext . mockResolvedValue ( {
211219 ...SURFACE_CONTEXT ,
212220 viewer : { role, isAdmin : role !== 'member' } ,
213221 searchAccess : { memberScoped : false , sourceMirrored : true } ,
214222 } )
215223
216- await expect (
217- OrganizationLayout ( {
224+ const html = renderToStaticMarkup (
225+ await OrganizationLayout ( {
218226 children : < div > Organization settings</ div > ,
219227 params : Promise . resolve ( { organizationId : 'org-1' } ) ,
220228 } )
221- ) . rejects . toThrow ( 'redirect:/workspace?redirect=settings' )
222- expect ( mockWorkspaceChrome ) . not . toHaveBeenCalled ( )
223- expect ( mockPrefetchOrganizationSidebar ) . not . toHaveBeenCalled ( )
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+ )
224242 }
225243 )
226244
0 commit comments