mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(server): empty/restore trash (#7161)
* fix(server): empty/restore trash * add e2e tests * add e2e tests - part 2
This commit is contained in:
parent
69983ff83a
commit
0730b54ca9
5 changed files with 101 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { AssetResponseDto } from '@app/domain';
|
||||
import { AssetBulkDeleteDto, AssetResponseDto } from '@app/domain';
|
||||
import { CreateAssetDto } from '@app/immich/api-v1/asset/dto/create-asset.dto';
|
||||
import { AssetFileUploadResponseDto } from '@app/immich/api-v1/asset/response-dto/asset-file-upload-response.dto';
|
||||
import { randomBytes } from 'node:crypto';
|
||||
|
|
@ -74,4 +74,8 @@ export const assetApi = {
|
|||
expect(status).toBe(200);
|
||||
return body;
|
||||
},
|
||||
delete: async (server: any, accessToken: string, dto: AssetBulkDeleteDto) => {
|
||||
const { status } = await request(server).delete('/asset').set('Authorization', `Bearer ${accessToken}`).send(dto);
|
||||
expect(status).toBe(204);
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { libraryApi } from './library-api';
|
|||
import { partnerApi } from './partner-api';
|
||||
import { serverInfoApi } from './server-info-api';
|
||||
import { sharedLinkApi } from './shared-link-api';
|
||||
import { trashApi } from './trash-api';
|
||||
import { userApi } from './user-api';
|
||||
|
||||
export const api = {
|
||||
|
|
@ -17,6 +18,7 @@ export const api = {
|
|||
libraryApi,
|
||||
serverInfoApi,
|
||||
sharedLinkApi,
|
||||
trashApi,
|
||||
albumApi,
|
||||
userApi,
|
||||
partnerApi,
|
||||
|
|
|
|||
13
server/e2e/client/trash-api.ts
Normal file
13
server/e2e/client/trash-api.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import request from 'supertest';
|
||||
import type { App } from 'supertest/types';
|
||||
|
||||
export const trashApi = {
|
||||
async empty(server: App, accessToken: string) {
|
||||
const { status } = await request(server).post('/trash/empty').set('Authorization', `Bearer ${accessToken}`);
|
||||
expect(status).toBe(204);
|
||||
},
|
||||
async restore(server: App, accessToken: string) {
|
||||
const { status } = await request(server).post('/trash/restore').set('Authorization', `Bearer ${accessToken}`);
|
||||
expect(status).toBe(204);
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue