mirror of
https://github.com/immich-app/immich
synced 2026-08-22 13:13:05 +00:00
28 lines
1,023 B
TypeScript
28 lines
1,023 B
TypeScript
import { DuplicateController } from 'src/controllers/duplicate.controller';
|
|
import { DuplicateService } from 'src/services/duplicate.service';
|
|
import request from 'supertest';
|
|
import { factory } from 'test/small.factory';
|
|
import { ControllerContext, controllerSetup, mockBaseService } from 'test/utils';
|
|
|
|
describe(DuplicateController.name, () => {
|
|
let ctx: ControllerContext;
|
|
const service = mockBaseService(DuplicateService);
|
|
|
|
beforeAll(async () => {
|
|
ctx = await controllerSetup(DuplicateController, [{ provide: DuplicateService, useValue: service }]);
|
|
return () => ctx.close();
|
|
});
|
|
|
|
beforeEach(() => {
|
|
service.resetAllMocks();
|
|
ctx.reset();
|
|
});
|
|
|
|
describe('DELETE /duplicates/:id', () => {
|
|
it('should require a valid uuid', async () => {
|
|
const { status, body } = await request(ctx.getHttpServer()).delete(`/duplicates/123`);
|
|
expect(status).toBe(400);
|
|
expect(body).toEqual(factory.responses.validationError([{ path: ['id'], message: 'Invalid UUID' }]));
|
|
});
|
|
});
|
|
});
|