@@ -19,7 +19,8 @@ const {
1919 onMock : vi . fn ( ) ,
2020 sessionState : {
2121 isAuthenticated : false ,
22- getBrowserSessionAccount : vi . fn ( ) ,
22+ hasAccessToken : false ,
23+ account : null as Record < string , unknown > | null ,
2324 } ,
2425 testPinia : { value : null as Pinia | null } ,
2526} ) )
@@ -63,7 +64,8 @@ describe('app initialization bootstrap', () => {
6364 testPinia . value = pinia
6465 localStorage . clear ( )
6566 sessionState . isAuthenticated = false
66- sessionState . getBrowserSessionAccount . mockReset ( )
67+ sessionState . hasAccessToken = false
68+ sessionState . account = null
6769 createHydroServerMock . mockReset ( )
6870 fetchAllVocabulariesMock . mockReset ( )
6971 userGetMock . mockReset ( )
@@ -109,11 +111,9 @@ describe('app initialization bootstrap', () => {
109111 it ( 'does not mark workspace bootstrap complete when initialized while logged out' , async ( ) => {
110112 createHydroServerMock . mockResolvedValue ( undefined )
111113 fetchAllVocabulariesMock . mockResolvedValue ( undefined )
112- sessionState . getBrowserSessionAccount . mockResolvedValue ( null )
113114
114115 const {
115116 hasBootstrappedWorkspaces,
116- isHydroServerAuthenticated,
117117 startAppInitialization,
118118 isAppInitializing,
119119 } = await import ( '../appInitialization' )
@@ -128,24 +128,22 @@ describe('app initialization bootstrap', () => {
128128 it ( 'hydrates authenticated ui state from the browser session when no oidc user is cached' , async ( ) => {
129129 createHydroServerMock . mockResolvedValue ( undefined )
130130 fetchAllVocabulariesMock . mockResolvedValue ( undefined )
131- sessionState . getBrowserSessionAccount . mockResolvedValue ( {
131+ sessionState . isAuthenticated = true
132+ sessionState . account = {
132133 email : 'browser@example.com' ,
133134 firstName : 'Browser' ,
134135 lastName : 'Session' ,
135- } )
136+ }
136137
137138 const {
138139 hasBootstrappedWorkspaces,
139- isHydroServerAuthenticated,
140140 startAppInitialization,
141141 } = await import ( '../appInitialization' )
142142
143143 await startAppInitialization ( )
144144
145145 const userStore = useUserStore ( )
146146
147- expect ( sessionState . getBrowserSessionAccount ) . toHaveBeenCalledTimes ( 1 )
148- expect ( isHydroServerAuthenticated . value ) . toBe ( true )
149147 expect ( userStore . user . email ) . toBe ( 'browser@example.com' )
150148 expect ( userStore . user . firstName ) . toBe ( 'Browser' )
151149 expect ( hasBootstrappedWorkspaces . value ) . toBe ( false )
@@ -155,9 +153,9 @@ describe('app initialization bootstrap', () => {
155153
156154 it ( 'loads vocabularies, user, and workspaces after first session initialization' , async ( ) => {
157155 sessionState . isAuthenticated = true
156+ sessionState . hasAccessToken = true
158157 createHydroServerMock . mockResolvedValue ( undefined )
159158 fetchAllVocabulariesMock . mockResolvedValue ( undefined )
160- sessionState . getBrowserSessionAccount . mockResolvedValue ( null )
161159 userGetMock . mockResolvedValue ( {
162160 status : 200 ,
163161 data : { email : 'user@example.com' } ,
@@ -169,7 +167,6 @@ describe('app initialization bootstrap', () => {
169167
170168 const {
171169 hasBootstrappedWorkspaces,
172- isHydroServerAuthenticated,
173170 startAppInitialization,
174171 isAppInitializing,
175172 } = await import ( '../appInitialization' )
@@ -195,7 +192,6 @@ describe('app initialization bootstrap', () => {
195192 'workspace-2' ,
196193 ] )
197194 expect ( workspaceStore . selectedWorkspace ?. id ) . toBe ( 'workspace-1' )
198- expect ( isHydroServerAuthenticated . value ) . toBe ( true )
199195 expect ( hasBootstrappedWorkspaces . value ) . toBe ( true )
200196 expect ( isAppInitializing . value ) . toBe ( false )
201197 } )
0 commit comments