fix(media-controller): throw if no file was uploaded

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-12-28 18:07:28 +01:00
parent 9d8d5e8d55
commit b311265762
2 changed files with 13 additions and 2 deletions

View file

@ -106,6 +106,13 @@ describe('Media', () => {
.expect('Content-Type', /json/)
.expect(500);
});
it('no media uploaded', async () => {
await agent
.post('/api/private/media')
.set('HedgeDoc-Note', 'test_upload_media')
.expect(400);
await expect(fs.access(uploadPath)).rejects.toBeDefined();
});
afterEach(async () => {
await ensureDeleted(uploadPath);
});