chore(web): add asset store unit tests (#8077)

chore(web): asset store unit tests
This commit is contained in:
Michel Heusschen 2024-03-20 05:41:31 +01:00 committed by GitHub
parent e6f2bb9f89
commit 9c6a26de9f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 407 additions and 9 deletions

View file

@ -0,0 +1,30 @@
import { faker } from '@faker-js/faker';
import { AssetTypeEnum, type AssetResponseDto } from '@immich/sdk';
import { Sync } from 'factory.ts';
export const assetFactory = Sync.makeFactory<AssetResponseDto>({
id: Sync.each(() => faker.string.uuid()),
deviceAssetId: Sync.each(() => faker.string.uuid()),
ownerId: Sync.each(() => faker.string.uuid()),
deviceId: '',
libraryId: Sync.each(() => faker.string.uuid()),
type: Sync.each(() => faker.helpers.enumValue(AssetTypeEnum)),
originalPath: Sync.each(() => faker.system.filePath()),
originalFileName: Sync.each(() => faker.system.fileName()),
resized: true,
thumbhash: Sync.each(() => faker.string.alphanumeric(28)),
fileCreatedAt: Sync.each(() => faker.date.past().toISOString()),
fileModifiedAt: Sync.each(() => faker.date.past().toISOString()),
localDateTime: Sync.each(() => faker.date.past().toISOString()),
updatedAt: Sync.each(() => faker.date.past().toISOString()),
isFavorite: Sync.each(() => faker.datatype.boolean()),
isArchived: Sync.each(() => faker.datatype.boolean()),
isTrashed: Sync.each(() => faker.datatype.boolean()),
duration: '0:00:00.00000',
checksum: Sync.each(() => faker.string.alphanumeric(28)),
isExternal: Sync.each(() => faker.datatype.boolean()),
isOffline: Sync.each(() => faker.datatype.boolean()),
isReadOnly: Sync.each(() => faker.datatype.boolean()),
hasMetadata: Sync.each(() => faker.datatype.boolean()),
stackCount: null,
});