import { describe, it, expect } from 'vitest'; import { createApp } from '../src/app'; const json = { 'content-type': 'application/json' }; describe('auth', () => { it('signs a user up and signs them in, returning a bearer token', async () => { const app = createApp(); const creds = { email: 'worker@example.com', password: 'sterk-wachtwoord-123', name: 'Worker' }; const signup = await app.request('/api/auth/sign-up/email', { method: 'POST', headers: json, body: JSON.stringify(creds), }); expect(signup.status).toBe(200); const signin = await app.request('/api/auth/sign-in/email', { method: 'POST', headers: json, body: JSON.stringify({ email: creds.email, password: creds.password }), }); expect(signin.status).toBe(200); const token = signin.headers.get('set-auth-token'); expect(token).toBeTruthy(); }); });