(store: storeType)
| 286 | } |
| 287 | |
| 288 | async function step3_signIn(store: storeType) { |
| 289 | await testApiHandler({ |
| 290 | handler: handlerAuth as any, |
| 291 | url: `/api/auth/callback/magic-link?token=${store.invited.signinToken}`, |
| 292 | test: async ({ fetch }) => { |
| 293 | const response = await fetch({ |
| 294 | method: 'GET', |
| 295 | redirect: 'manual', |
| 296 | }); |
| 297 | |
| 298 | expect(response.status).toEqual(307); |
| 299 | expect(response.cookies).toBeDefined(); |
| 300 | const sessionCookie = response.cookies.find( |
| 301 | (c) => !!c['linen.session-token'] |
| 302 | ); |
| 303 | expect(sessionCookie).toMatchObject({ |
| 304 | 'linen.session-token': expect.any(String), |
| 305 | Path: '/', |
| 306 | path: '/', |
| 307 | SameSite: 'Lax', |
| 308 | samesite: 'Lax', |
| 309 | }); |
| 310 | store.invited.token = sessionCookie!['linen.session-token']; |
| 311 | |
| 312 | expect(response.headers).toBeDefined(); |
| 313 | const location = response.headers.get('location'); |
| 314 | expect(location).toBeDefined(); |
| 315 | expect(location).toContain('/api/router'); |
| 316 | }, |
| 317 | }); |
| 318 | } |
| 319 | |
| 320 | async function step4_router(store: storeType) { |
| 321 | let location: string = ''; |
no test coverage detected