mirror of
https://github.com/immich-app/immich.git
synced 2026-02-28 01:29:04 +03:00
refactor: small face tests (#26340)
This commit is contained in:
160
server/test/fixtures/face.stub.ts
vendored
160
server/test/fixtures/face.stub.ts
vendored
@@ -1,160 +0,0 @@
|
||||
import { SourceType } from 'src/enum';
|
||||
import { AssetFactory } from 'test/factories/asset.factory';
|
||||
import { personStub } from 'test/fixtures/person.stub';
|
||||
|
||||
export const faceStub = {
|
||||
face1: Object.freeze({
|
||||
id: 'assetFaceId1',
|
||||
assetId: 'asset-id',
|
||||
asset: {
|
||||
...AssetFactory.create({ id: 'asset-id' }),
|
||||
libraryId: null,
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
stackId: null,
|
||||
},
|
||||
personId: personStub.withName.id,
|
||||
person: personStub.withName,
|
||||
boundingBoxX1: 0,
|
||||
boundingBoxY1: 0,
|
||||
boundingBoxX2: 1,
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId1', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: new Date(),
|
||||
updatedAt: new Date('2023-01-01T00:00:00Z'),
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
isVisible: true,
|
||||
}),
|
||||
primaryFace1: Object.freeze({
|
||||
id: 'assetFaceId2',
|
||||
assetId: 'asset-id',
|
||||
asset: AssetFactory.create({ id: 'asset-id' }),
|
||||
personId: personStub.primaryPerson.id,
|
||||
person: personStub.primaryPerson,
|
||||
boundingBoxX1: 0,
|
||||
boundingBoxY1: 0,
|
||||
boundingBoxX2: 1,
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId2', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: null,
|
||||
updatedAt: new Date('2023-01-01T00:00:00Z'),
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
isVisible: true,
|
||||
}),
|
||||
mergeFace1: Object.freeze({
|
||||
id: 'assetFaceId3',
|
||||
assetId: 'asset-id',
|
||||
asset: AssetFactory.create({ id: 'asset-id' }),
|
||||
personId: personStub.mergePerson.id,
|
||||
person: personStub.mergePerson,
|
||||
boundingBoxX1: 0,
|
||||
boundingBoxY1: 0,
|
||||
boundingBoxX2: 1,
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId3', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: null,
|
||||
updatedAt: new Date('2023-01-01T00:00:00Z'),
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
isVisible: true,
|
||||
}),
|
||||
noPerson1: Object.freeze({
|
||||
id: 'assetFaceId8',
|
||||
assetId: 'asset-id',
|
||||
asset: AssetFactory.create({ id: 'asset-id' }),
|
||||
personId: null,
|
||||
person: null,
|
||||
boundingBoxX1: 0,
|
||||
boundingBoxY1: 0,
|
||||
boundingBoxX2: 1,
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId8', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: null,
|
||||
updatedAt: new Date('2023-01-01T00:00:00Z'),
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
isVisible: true,
|
||||
}),
|
||||
noPerson2: Object.freeze({
|
||||
id: 'assetFaceId9',
|
||||
assetId: 'asset-id',
|
||||
asset: AssetFactory.create({ id: 'asset-id' }),
|
||||
personId: null,
|
||||
person: null,
|
||||
boundingBoxX1: 0,
|
||||
boundingBoxY1: 0,
|
||||
boundingBoxX2: 1,
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
faceSearch: { faceId: 'assetFaceId9', embedding: '[1, 2, 3, 4]' },
|
||||
deletedAt: null,
|
||||
updatedAt: new Date('2023-01-01T00:00:00Z'),
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
isVisible: true,
|
||||
}),
|
||||
fromExif1: Object.freeze({
|
||||
id: 'assetFaceId9',
|
||||
assetId: 'asset-id',
|
||||
asset: AssetFactory.create({ id: 'asset-id' }),
|
||||
personId: personStub.randomPerson.id,
|
||||
person: personStub.randomPerson,
|
||||
boundingBoxX1: 100,
|
||||
boundingBoxY1: 100,
|
||||
boundingBoxX2: 200,
|
||||
boundingBoxY2: 200,
|
||||
imageHeight: 500,
|
||||
imageWidth: 400,
|
||||
sourceType: SourceType.Exif,
|
||||
deletedAt: null,
|
||||
updatedAt: new Date('2023-01-01T00:00:00Z'),
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
isVisible: true,
|
||||
}),
|
||||
fromExif2: Object.freeze({
|
||||
id: 'assetFaceId9',
|
||||
assetId: 'asset-id',
|
||||
asset: AssetFactory.create({ id: 'asset-id' }),
|
||||
personId: personStub.randomPerson.id,
|
||||
person: personStub.randomPerson,
|
||||
boundingBoxX1: 0,
|
||||
boundingBoxY1: 0,
|
||||
boundingBoxX2: 1,
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.Exif,
|
||||
deletedAt: null,
|
||||
updatedAt: new Date('2023-01-01T00:00:00Z'),
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
isVisible: true,
|
||||
}),
|
||||
withBirthDate: Object.freeze({
|
||||
id: 'assetFaceId10',
|
||||
assetId: 'asset-id',
|
||||
asset: AssetFactory.create({ id: 'asset-id' }),
|
||||
personId: personStub.withBirthDate.id,
|
||||
person: personStub.withBirthDate,
|
||||
boundingBoxX1: 0,
|
||||
boundingBoxY1: 0,
|
||||
boundingBoxX2: 1,
|
||||
boundingBoxY2: 1,
|
||||
imageHeight: 1024,
|
||||
imageWidth: 1024,
|
||||
sourceType: SourceType.MachineLearning,
|
||||
deletedAt: null,
|
||||
updatedAt: new Date('2023-01-01T00:00:00Z'),
|
||||
updateId: '0d1173e3-4d80-4d76-b41e-57d56de21125',
|
||||
isVisible: true,
|
||||
}),
|
||||
};
|
||||
Reference in New Issue
Block a user