mirror of
https://github.com/immich-app/immich.git
synced 2025-07-09 03:04:16 -04:00
update tests
This commit is contained in:
parent
683a10f0fe
commit
89bfa692b1
@ -1,5 +1,5 @@
|
|||||||
|
import type { TimelineAsset } from '$lib/stores/assets-store.svelte';
|
||||||
import { getAltText } from '$lib/utils/thumbnail-util';
|
import { getAltText } from '$lib/utils/thumbnail-util';
|
||||||
import { AssetTypeEnum, type AssetResponseDto } from '@immich/sdk';
|
|
||||||
import { init, register, waitLocale } from 'svelte-i18n';
|
import { init, register, waitLocale } from 'svelte-i18n';
|
||||||
|
|
||||||
const onePerson = [{ name: 'person' }];
|
const onePerson = [{ name: 'person' }];
|
||||||
@ -40,25 +40,16 @@ describe('getAltText', () => {
|
|||||||
'generates correctly formatted alt text when isVideo=$isVideo, city=$city, country=$country, people=$people.length',
|
'generates correctly formatted alt text when isVideo=$isVideo, city=$city, country=$country, people=$people.length',
|
||||||
({ isVideo, city, country, people, expected }) => {
|
({ isVideo, city, country, people, expected }) => {
|
||||||
const asset = {
|
const asset = {
|
||||||
exifInfo: { city, country },
|
text: { city, country, people: (people || [])?.map((p: { name: string }) => p.name) },
|
||||||
localDateTime: '2024-01-01T12:00:00.000Z',
|
localDateTime: '2024-01-01T12:00:00.000Z',
|
||||||
people,
|
people,
|
||||||
type: isVideo ? AssetTypeEnum.Video : AssetTypeEnum.Image,
|
isVideo,
|
||||||
} as AssetResponseDto;
|
isImage: !isVideo,
|
||||||
|
} as unknown as TimelineAsset;
|
||||||
|
|
||||||
getAltText.subscribe((fn) => {
|
getAltText.subscribe((fn) => {
|
||||||
expect(fn(asset)).toEqual(expected);
|
expect(fn(asset)).toEqual(expected);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it('defaults to the description, if available', () => {
|
|
||||||
const asset = {
|
|
||||||
exifInfo: { description: 'description' },
|
|
||||||
} as AssetResponseDto;
|
|
||||||
|
|
||||||
getAltText.subscribe((fn) => {
|
|
||||||
expect(fn(asset)).toEqual('description');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user