@@ -46,7 +46,6 @@ describe('organization Search page gates', () => {
4646 [ 'Home' , ( ) => OrganizationHomePage ( { params } ) ] ,
4747 [ 'Search' , ( ) => OrganizationSearchPage ( { params } ) ] ,
4848 [ 'chat' , ( ) => OrganizationChatPage ( { params } ) ] ,
49- [ 'organization entry' , ( ) => OrganizationPage ( { params } ) ] ,
5049 ] as const ) ( 'redirects %s to workspace settings when Search is disabled' , async ( _name , open ) => {
5150 mocks . context . mockResolvedValue ( { searchAccess : { memberScoped : false , sourceMirrored : true } } )
5251 await expect ( open ( ) ) . rejects . toThrow ( 'redirect:/workspace?redirect=settings' )
@@ -58,6 +57,7 @@ describe('organization Search page gates', () => {
5857 [ 'Home' , ( ) => OrganizationHomePage ( { params } ) ] ,
5958 [ 'Search' , ( ) => OrganizationSearchPage ( { params } ) ] ,
6059 [ 'chat' , ( ) => OrganizationChatPage ( { params } ) ] ,
60+ [ 'organization entry' , ( ) => OrganizationPage ( { params } ) ] ,
6161 ] as const ) ( 'denies %s to nonmembers before loading content' , async ( _name , open ) => {
6262 mocks . context . mockResolvedValue ( null )
6363 await expect ( open ( ) ) . rejects . toThrow ( 'not-found' )
@@ -90,6 +90,21 @@ describe('organization Search page gates', () => {
9090 await expect ( OrganizationPage ( { params } ) ) . rejects . toThrow ( 'redirect:/o/org-1/home' )
9191 } )
9292
93+ it ( 'preserves the organization entry through sign-in' , async ( ) => {
94+ authMockFns . mockGetSession . mockResolvedValue ( null )
95+
96+ await expect ( OrganizationPage ( { params } ) ) . rejects . toThrow (
97+ 'redirect:/login?callbackUrl=%2Fo%2Forg-1'
98+ )
99+ expect ( mocks . context ) . not . toHaveBeenCalled ( )
100+ } )
101+
102+ it ( 'keeps the organization entry in organization settings when Search is disabled' , async ( ) => {
103+ mocks . context . mockResolvedValue ( { searchAccess : { memberScoped : false } } )
104+ await expect ( OrganizationPage ( { params } ) ) . rejects . toThrow ( 'redirect:/o/org-1/settings/members' )
105+ expect ( mocks . context ) . toHaveBeenCalledWith ( 'org-1' , 'viewer' )
106+ } )
107+
93108 it ( 'propagates availability failures instead of rendering the Assistant' , async ( ) => {
94109 mocks . context . mockRejectedValue ( new Error ( 'Availability unavailable' ) )
95110 await expect ( OrganizationHomePage ( { params } ) ) . rejects . toThrow ( 'Availability unavailable' )
0 commit comments