forked from mtusi2026/mtusi2026lab4
fix: accept any well-formed uuid so unknown ids return 404
This commit is contained in:
@@ -106,6 +106,23 @@ describe('Скачивание и привязка вложений (e2e)', () =
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
['nil', '00000000-0000-0000-0000-000000000000'],
|
||||
['v7', '018f6f3a-7b1c-7def-8abc-0123456789ab'],
|
||||
])('UUID %s корректного формата — 404, а не 400', async (_name, id) => {
|
||||
await get(`/api/v1/attachments/${id}`).expect(404);
|
||||
await get(`/api/v1/attachments/${id}/content`).expect(404);
|
||||
await get(`/api/v1/chats/${id}`, alice).expect(404);
|
||||
await send({ text: 'x', attachment_ids: [id] }).expect(404);
|
||||
await send({ text: 'x' }, { chat: id }).expect(404);
|
||||
await request(server)
|
||||
.post(`/api/v1/chats/${id}/attachments?filename=a.png`)
|
||||
.set('Authorization', bearer(alice))
|
||||
.set('Content-Type', 'image/png')
|
||||
.send(SAMPLE_PNG)
|
||||
.expect(404);
|
||||
});
|
||||
|
||||
it('без токена 401, неверный UUID 400', async () => {
|
||||
const attachment = await upload();
|
||||
for (const suffix of ['', '/content']) {
|
||||
|
||||
Reference in New Issue
Block a user