test(api): Auth & /me — fill gaps + lifecycle test

This commit is contained in:
Bas van Rossem
2026-07-22 11:50:32 +02:00
parent 2fa8aa9154
commit e6e4ca0a1e
5 changed files with 133 additions and 1 deletions

View File

@@ -9,6 +9,17 @@ describe('auth', () => {
expect(token).toBeTruthy();
});
it('rejects sign-in with a wrong password', async () => {
const app = createApp();
await authToken(app, 'wrong-pw@example.com'); // create the user first
const res = await app.request('/api/auth/sign-in/email', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ email: 'wrong-pw@example.com', password: 'not-the-password' }),
});
expect(res.status).toBeGreaterThanOrEqual(400);
});
it('rejects public sign-up (admin creates users)', async () => {
const app = createApp();
const res = await app.request('/api/auth/sign-up/email', {