test(api): Auth & /me — fill gaps + lifecycle test
This commit is contained in:
@@ -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', {
|
||||
|
||||
Reference in New Issue
Block a user