mirror of
https://github.com/immich-app/immich.git
synced 2024-12-29 11:24:37 +02:00
8d5bf93360
* feat: asset e2e with job option * feat: checkout test assets * feat: library e2e tests * fix: use node 21 in e2e * fix: tests * fix: use normalized external path * feat: more external path tests * chore: use parametrized tests * chore: remove unused test code * chore: refactor test asset path * feat: centralize test app creation * fix: correct error message for missing assets * feat: test file formats * fix: don't compare checksum * feat: build libvips * fix: install meson * fix: use immich test asset repo * feat: test nikon raw files * fix: set Z timezone * feat: test offline library files * feat: richer metadata tests * feat: e2e tests in docker * feat: e2e test with arm64 docker * fix: manual docker compose run * fix: remove metadata processor import * fix: run e2e tests in test.yml * fix: checkout e2e assets * fix: typo * fix: checkout files in app directory * fix: increase e2e memory * fix: rm submodules * fix: revert action name * test: mark file offline when external path changes * feat: rename env var to TEST_ENV * docs: new test procedures * feat: can run docker e2e tests manually if needed * chore: use new node 20.8 for e2e * chore: bump exiftool-vendored * feat: simplify test launching * fix: rename env vars to use immich_ prefix * feat: asset folder is submodule * chore: cleanup after 20.8 upgrade * fix: don't log postgres in e2e * fix: better warning about not running all tests --------- Co-authored-by: Jonathan Jogenfors <jonathan@jogenfors.se>
51 lines
1.7 KiB
TypeScript
51 lines
1.7 KiB
TypeScript
import { CreateUserDto, UpdateUserDto, UserResponseDto } from '@app/domain';
|
|
import request from 'supertest';
|
|
|
|
export const userApi = {
|
|
create: async (server: any, accessToken: string, dto: CreateUserDto) => {
|
|
const { status, body } = await request(server)
|
|
.post('/user')
|
|
.set('Authorization', `Bearer ${accessToken}`)
|
|
.send(dto);
|
|
|
|
expect(status).toBe(201);
|
|
expect(body).toMatchObject({
|
|
id: expect.any(String),
|
|
createdAt: expect.any(String),
|
|
updatedAt: expect.any(String),
|
|
email: dto.email,
|
|
});
|
|
|
|
return body as UserResponseDto;
|
|
},
|
|
get: async (server: any, accessToken: string, id: string) => {
|
|
const { status, body } = await request(server)
|
|
.get(`/user/info/${id}`)
|
|
.set('Authorization', `Bearer ${accessToken}`);
|
|
|
|
expect(status).toBe(200);
|
|
expect(body).toMatchObject({ id });
|
|
|
|
return body as UserResponseDto;
|
|
},
|
|
update: async (server: any, accessToken: string, dto: UpdateUserDto) => {
|
|
const { status, body } = await request(server).put('/user').set('Authorization', `Bearer ${accessToken}`).send(dto);
|
|
|
|
expect(status).toBe(200);
|
|
expect(body).toMatchObject({ id: dto.id });
|
|
|
|
return body as UserResponseDto;
|
|
},
|
|
setExternalPath: async (server: any, accessToken: string, id: string, externalPath: string) => {
|
|
return await userApi.update(server, accessToken, { id, externalPath });
|
|
},
|
|
delete: async (server: any, accessToken: string, id: string) => {
|
|
const { status, body } = await request(server).delete(`/user/${id}`).set('Authorization', `Bearer ${accessToken}`);
|
|
|
|
expect(status).toBe(200);
|
|
expect(body).toMatchObject({ id, deletedAt: expect.any(String) });
|
|
|
|
return body as UserResponseDto;
|
|
},
|
|
};
|