1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-06 11:56:46 +01:00
immich/server/test/api/album-api.ts

19 lines
745 B
TypeScript
Raw Normal View History

import { AlbumResponseDto, BulkIdResponseDto, BulkIdsDto, CreateAlbumDto } from '@app/domain';
import request from 'supertest';
export const albumApi = {
create: async (server: any, accessToken: string, dto: CreateAlbumDto) => {
const res = await request(server).post('/album').set('Authorization', `Bearer ${accessToken}`).send(dto);
expect(res.status).toEqual(201);
return res.body as AlbumResponseDto;
},
addAssets: async (server: any, accessToken: string, id: string, dto: BulkIdsDto) => {
const res = await request(server)
.put(`/album/${id}/assets`)
.set('Authorization', `Bearer ${accessToken}`)
.send(dto);
expect(res.status).toEqual(200);
return res.body as BulkIdResponseDto[];
},
};