| 318 | } |
| 319 | |
| 320 | async function step4_router(store: storeType) { |
| 321 | let location: string = ''; |
| 322 | await testApiHandler({ |
| 323 | handler: handlerRouter, |
| 324 | url: `/api/router`, |
| 325 | test: async ({ fetch }) => { |
| 326 | const response = await fetch({ |
| 327 | method: 'GET', |
| 328 | redirect: 'manual', |
| 329 | headers: { |
| 330 | Authorization: `Bearer ${store.invited.token}`, |
| 331 | }, |
| 332 | }); |
| 333 | |
| 334 | expect(response.status).toEqual(307); |
| 335 | expect(response.headers).toBeDefined(); |
| 336 | |
| 337 | location = response.headers.get('location'); |
| 338 | expect(location).toBeDefined(); |
| 339 | }, |
| 340 | }); |
| 341 | return new URL(location).pathname; |
| 342 | } |
| 343 | |
| 344 | async function step5_postThread(store: storeType) { |
| 345 | await testApiHandler({ |