fix: fixes after review

This commit is contained in:
2026-10-22 12:41:28 +03:00
parent 07661cfe82
commit 5146ca8419
8 changed files with 112 additions and 11 deletions
+12
View File
@@ -97,6 +97,18 @@ describe('Аутентификация и сессии (e2e)', () => {
expect(wrong.body.error.message).toBe(unknown.body.error.message);
});
it('отклоняет JSON body при входе даже с верным Basic', async () => {
const user = await registerUser(server, 'body');
for (const body of [{ extra: 'forbidden' }, {}]) {
const res = await request(server)
.post('/api/v1/auth/sessions')
.set('Authorization', basic(user.username, PASSWORD))
.send(body)
.expect(400);
expect(res.body.error.code).toBe('invalid_request');
}
});
it('отвечает 401 без заголовка Authorization', async () => {
const res = await request(server)
.post('/api/v1/auth/sessions')