mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 09:38:43 +03:00
refactor: small face tests (#26340)
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { Selectable } from 'kysely';
|
||||
import { AssetTable } from 'src/schema/tables/asset.table';
|
||||
import { AssetFaceFactory } from 'test/factories/asset-face.factory';
|
||||
import { AssetFactory } from 'test/factories/asset.factory';
|
||||
|
||||
export const getForStorageTemplate = (asset: ReturnType<AssetFactory['build']>) => {
|
||||
@@ -20,3 +23,29 @@ export const getForStorageTemplate = (asset: ReturnType<AssetFactory['build']>)
|
||||
isEdited: asset.isEdited,
|
||||
};
|
||||
};
|
||||
|
||||
export const getAsDetectedFace = (face: ReturnType<AssetFaceFactory['build']>) => ({
|
||||
faces: [
|
||||
{
|
||||
boundingBox: {
|
||||
x1: face.boundingBoxX1,
|
||||
y1: face.boundingBoxY1,
|
||||
x2: face.boundingBoxX2,
|
||||
y2: face.boundingBoxY2,
|
||||
},
|
||||
embedding: '[1, 2, 3, 4]',
|
||||
score: 0.2,
|
||||
},
|
||||
],
|
||||
imageHeight: face.imageHeight,
|
||||
imageWidth: face.imageWidth,
|
||||
});
|
||||
|
||||
export const getForFacialRecognitionJob = (
|
||||
face: ReturnType<AssetFaceFactory['build']>,
|
||||
asset: Pick<Selectable<AssetTable>, 'ownerId' | 'visibility' | 'fileCreatedAt'> | null,
|
||||
) => ({
|
||||
...face,
|
||||
asset,
|
||||
faceSearch: { faceId: face.id, embedding: '[1, 2, 3, 4]' },
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user