MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / step3_signIn

Function step3_signIn

apps/web/__tests__/invites.test.ts:288–318  ·  view source on GitHub ↗
(store: storeType)

Source from the content-addressed store, hash-verified

286}
287
288async 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
320async function step4_router(store: storeType) {
321 let location: string = '';

Callers 1

invites.test.tsFile · 0.85

Calls 2

findMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected