@@ -94,7 +94,8 @@ describe('Google OAuth Client Middleware', () => {
9494 query : { oauth_success : 'true' }
9595 }
9696
97- await authorizationMiddleware . default ( to as any )
97+ const from = { path : '/login' } as any
98+ await authorizationMiddleware . default ( to as any , from )
9899
99100 // Should call fetchUser with SSR enabled
100101 expect ( mockFetchUser ) . toHaveBeenCalledWith ( true )
@@ -129,7 +130,8 @@ describe('Google OAuth Client Middleware', () => {
129130 query : { oauth_success : 'true' }
130131 }
131132
132- await authorizationMiddleware . default ( to as any )
133+ const from = { path : '/login' } as any
134+ await authorizationMiddleware . default ( to as any , from )
133135
134136 expect ( mockFetchUser ) . toHaveBeenCalledWith ( true )
135137 // After fetch, should NOT redirect to login
@@ -150,7 +152,8 @@ describe('Google OAuth Client Middleware', () => {
150152 query : { oauth_success : 'true' }
151153 }
152154
153- await authorizationMiddleware . default ( to as any )
155+ const from = { path : '/login' } as any
156+ await authorizationMiddleware . default ( to as any , from )
154157
155158 expect ( mockFetchUser ) . toHaveBeenCalledWith ( true )
156159 // After failed fetch, should redirect to login
@@ -177,7 +180,8 @@ describe('Google OAuth Client Middleware', () => {
177180 query : { oauth_success : 'true' }
178181 }
179182
180- await authorizationMiddleware . default ( to as any )
183+ const from = { path : '/login' } as any
184+ await authorizationMiddleware . default ( to as any , from )
181185
182186 // Should not fetch user if already authenticated
183187 expect ( mockFetchUser ) . not . toHaveBeenCalled ( )
@@ -199,7 +203,8 @@ describe('Google OAuth Client Middleware', () => {
199203 query : { }
200204 }
201205
202- await authorizationMiddleware . default ( to as any )
206+ const from = { path : '/login' } as any
207+ await authorizationMiddleware . default ( to as any , from )
203208
204209 // Should NOT fetch user without oauth_success flag
205210 expect ( mockFetchUser ) . not . toHaveBeenCalled ( )
@@ -223,7 +228,8 @@ describe('Google OAuth Client Middleware', () => {
223228 query : { oauth_success : 'true' }
224229 }
225230
226- await authorizationMiddleware . default ( to as any )
231+ const from = { path : '/login' } as any
232+ await authorizationMiddleware . default ( to as any , from )
227233
228234 // Should call with true to enable SSR (critical for httpOnly cookies)
229235 expect ( mockFetchUser ) . toHaveBeenCalledWith ( true )
@@ -254,7 +260,8 @@ describe('Google OAuth Client Middleware', () => {
254260 query : { }
255261 }
256262
257- const result = await authorizationMiddleware . default ( to as any )
263+ const from = { path : '/login' } as any
264+ const result = await authorizationMiddleware . default ( to as any , from )
258265
259266 expect ( result ) . toBeUndefined ( ) // Middleware allows passage
260267 expect ( mockNavigateTo ) . not . toHaveBeenCalled ( )
@@ -283,7 +290,8 @@ describe('Google OAuth Client Middleware', () => {
283290 query : { }
284291 }
285292
286- await authorizationMiddleware . default ( to as any )
293+ const from = { path : '/login' } as any
294+ await authorizationMiddleware . default ( to as any , from )
287295
288296 expect ( mockNavigateTo ) . toHaveBeenCalledWith ( '/login' )
289297 } )
@@ -305,7 +313,8 @@ describe('Google OAuth Client Middleware', () => {
305313 query : { oauth_success : 'true' }
306314 }
307315
308- const result = await authorizationMiddleware . default ( to as any )
316+ const from = { path : '/login' } as any
317+ const result = await authorizationMiddleware . default ( to as any , from )
309318
310319 // Should not fetch user or redirect
311320 expect ( mockFetchUser ) . not . toHaveBeenCalled ( )
0 commit comments