@@ -19,6 +19,11 @@ import { loader } from './callback.ts'
1919
2020const ROUTE_PATH = '/auth/github/callback'
2121const PARAMS = { provider : 'github' }
22+ const LOADER_ARGS_BASE = {
23+ params : PARAMS ,
24+ context : { } as AppLoadContext ,
25+ unstable_pattern : ROUTE_PATH ,
26+ }
2227
2328afterEach ( async ( ) => {
2429 await deleteGitHubUsers ( )
@@ -28,8 +33,7 @@ test('a new user goes to onboarding', async () => {
2833 const request = await setupRequest ( )
2934 const response = await loader ( {
3035 request,
31- params : PARAMS ,
32- context : { } as AppLoadContext ,
36+ ...LOADER_ARGS_BASE ,
3337 } ) . catch ( ( e ) => e )
3438 expect ( response ) . toHaveRedirect ( '/onboarding/github' )
3539} )
@@ -44,8 +48,7 @@ test('when auth fails, send the user to login with a toast', async () => {
4448 const request = await setupRequest ( )
4549 const response = await loader ( {
4650 request,
47- params : PARAMS ,
48- context : { } as AppLoadContext ,
51+ ...LOADER_ARGS_BASE ,
4952 } ) . catch ( ( e ) => e )
5053 invariant ( response instanceof Response , 'response should be a Response' )
5154 expect ( response ) . toHaveRedirect ( '/login' )
@@ -67,8 +70,7 @@ test('when a user is logged in, it creates the connection', async () => {
6770 } )
6871 const response = await loader ( {
6972 request,
70- params : PARAMS ,
71- context : { } as AppLoadContext ,
73+ ...LOADER_ARGS_BASE ,
7274 } )
7375 expect ( response ) . toHaveRedirect ( '/settings/profile/connections' )
7476 await expect ( response ) . toSendToast (
@@ -107,8 +109,7 @@ test(`when a user is logged in and has already connected, it doesn't do anything
107109 } )
108110 const response = await loader ( {
109111 request,
110- params : PARAMS ,
111- context : { } as AppLoadContext ,
112+ ...LOADER_ARGS_BASE ,
112113 } )
113114 expect ( response ) . toHaveRedirect ( '/settings/profile/connections' )
114115 await expect ( response ) . toSendToast (
@@ -126,8 +127,7 @@ test('when a user exists with the same email, create connection and make session
126127 const request = await setupRequest ( { code : githubUser . code } )
127128 const response = await loader ( {
128129 request,
129- params : PARAMS ,
130- context : { } as AppLoadContext ,
130+ ...LOADER_ARGS_BASE ,
131131 } )
132132
133133 expect ( response ) . toHaveRedirect ( '/' )
@@ -174,8 +174,7 @@ test('gives an error if the account is already connected to another user', async
174174 } )
175175 const response = await loader ( {
176176 request,
177- params : PARAMS ,
178- context : { } as AppLoadContext ,
177+ ...LOADER_ARGS_BASE ,
179178 } )
180179 expect ( response ) . toHaveRedirect ( '/settings/profile/connections' )
181180 await expect ( response ) . toSendToast (
@@ -201,8 +200,7 @@ test('if a user is not logged in, but the connection exists, make a session', as
201200 const request = await setupRequest ( { code : githubUser . code } )
202201 const response = await loader ( {
203202 request,
204- params : PARAMS ,
205- context : { } as AppLoadContext ,
203+ ...LOADER_ARGS_BASE ,
206204 } )
207205 expect ( response ) . toHaveRedirect ( '/' )
208206 await expect ( response ) . toHaveSessionForUser ( userId )
@@ -229,8 +227,7 @@ test('if a user is not logged in, but the connection exists and they have enable
229227 const request = await setupRequest ( { code : githubUser . code } )
230228 const response = await loader ( {
231229 request,
232- params : PARAMS ,
233- context : { } as AppLoadContext ,
230+ ...LOADER_ARGS_BASE ,
234231 } )
235232 const searchParams = new URLSearchParams ( {
236233 type : twoFAVerificationType ,
0 commit comments