mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-21 02:35:23 -04:00
refactor(api/private/media): return MediaUpload object instead of url
This ensures the private POST /media API behaves in the same way as /me/media Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
4f10e17d40
commit
8e31f3a393
10 changed files with 50 additions and 43 deletions
|
@ -64,7 +64,7 @@ describe('Media', () => {
|
|||
.set('HedgeDoc-Note', 'test_upload_media')
|
||||
.expect('Content-Type', /json/)
|
||||
.expect(201);
|
||||
const path: string = uploadResponse.body.link;
|
||||
const path: string = uploadResponse.body.url;
|
||||
const testImage = await fs.readFile('test/private-api/fixtures/test.png');
|
||||
const downloadResponse = await agent.get(path);
|
||||
expect(downloadResponse.body).toEqual(testImage);
|
||||
|
@ -117,12 +117,12 @@ describe('Media', () => {
|
|||
'test_delete_media',
|
||||
);
|
||||
const testImage = await fs.readFile('test/private-api/fixtures/test.png');
|
||||
const url = await testSetup.mediaService.saveFile(
|
||||
const upload = await testSetup.mediaService.saveFile(
|
||||
testImage,
|
||||
user,
|
||||
testNote,
|
||||
);
|
||||
const filename = url.split('/').pop() || '';
|
||||
const filename = upload.fileUrl.split('/').pop() || '';
|
||||
await agent.delete('/api/private/media/' + filename).expect(204);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue