forked from mtusi2026/mtusi2026lab4
feat: add upload experiment, attachment scenarios and health extension
This commit is contained in:
@@ -325,6 +325,24 @@ describe('Загрузка вложений (e2e)', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('необработанная ошибка PostgreSQL при INSERT — 503, объект не удаляется', async () => {
|
||||
const prisma = app.get(PrismaService);
|
||||
const s3 = app.get(S3Service);
|
||||
const remove = jest.spyOn(s3, 'delete');
|
||||
const create = jest.spyOn(prisma.attachment, 'create').mockRejectedValueOnce(
|
||||
new Prisma.PrismaClientUnknownRequestError('server closed the connection', {
|
||||
clientVersion: 'test',
|
||||
}),
|
||||
);
|
||||
try {
|
||||
expectError(await upload(SAMPLE_PNG), 503, 'unavailable');
|
||||
expect(remove).not.toHaveBeenCalled();
|
||||
} finally {
|
||||
create.mockRestore();
|
||||
remove.mockRestore();
|
||||
}
|
||||
});
|
||||
|
||||
it('при неясном исходе COMMIT объект не удаляется', async () => {
|
||||
const prisma = app.get(PrismaService);
|
||||
const s3 = app.get(S3Service);
|
||||
|
||||
Reference in New Issue
Block a user