passing medium tests

This commit is contained in:
mertalev 2025-10-15 15:45:35 -04:00
parent c3bb212480
commit 5809992138
No known key found for this signature in database
GPG key ID: DF6ABC77AAD98C95
3 changed files with 89 additions and 28 deletions

View file

@ -47,6 +47,7 @@ import { VersionHistoryRepository } from 'src/repositories/version-history.repos
import { DB } from 'src/schema';
import { AlbumTable } from 'src/schema/tables/album.table';
import { AssetExifTable } from 'src/schema/tables/asset-exif.table';
import { AssetFileTable } from 'src/schema/tables/asset-file.table';
import { AssetJobStatusTable } from 'src/schema/tables/asset-job-status.table';
import { AssetTable } from 'src/schema/tables/asset.table';
import { FaceSearchTable } from 'src/schema/tables/face-search.table';
@ -167,6 +168,11 @@ export class MediumTestContext<S extends BaseService = BaseService> {
return { asset, result };
}
async newAssetFile(dto: Insertable<AssetFileTable>) {
const result = await this.get(AssetRepository).upsertFile(dto);
return { result };
}
async newAssetFace(dto: Partial<Insertable<AssetFace>> & { assetId: string }) {
const assetFace = mediumFactory.assetFaceInsert(dto);
const result = await this.get(PersonRepository).createAssetFace(assetFace);
@ -339,7 +345,6 @@ const newMockRepository = <T>(key: ClassConstructor<T>) => {
case AssetJobRepository:
case ConfigRepository:
case CryptoRepository:
case MachineLearningRepository:
case MemoryRepository:
case NotificationRepository:
case OcrRepository:
@ -390,6 +395,10 @@ const newMockRepository = <T>(key: ClassConstructor<T>) => {
return automock(LoggingRepository, { args: [undefined, configMock], strict: false });
}
case MachineLearningRepository: {
return automock(MachineLearningRepository, { args: [{ setContext: () => {} }] });
}
case StorageRepository: {
return automock(StorageRepository, { args: [{ setContext: () => {} }] });
}