mirror of
https://github.com/immich-app/immich.git
synced 2025-12-18 17:23:16 +03:00
* feat: Improve duplicate suggestion * format * feat(web): Add deduplication info popup * fix: lint * fmt --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
30 lines
1.1 KiB
TypeScript
30 lines
1.1 KiB
TypeScript
import { getExifCount } from '$lib/utils/exif-utils';
|
|
import type { AssetResponseDto } from '@immich/sdk';
|
|
|
|
describe('getting the exif count', () => {
|
|
it('returns 0 when exifInfo is undefined', () => {
|
|
const asset = {};
|
|
expect(getExifCount(asset as AssetResponseDto)).toBe(0);
|
|
});
|
|
|
|
it('returns 0 when exifInfo is empty', () => {
|
|
const asset = { exifInfo: {} };
|
|
expect(getExifCount(asset as AssetResponseDto)).toBe(0);
|
|
});
|
|
|
|
it('returns the correct count of non-null exifInfo properties', () => {
|
|
const asset = { exifInfo: { fileSizeInByte: 200, rating: 5, fNumber: null } };
|
|
expect(getExifCount(asset as AssetResponseDto)).toBe(2);
|
|
});
|
|
|
|
it('ignores null, undefined and empty properties in exifInfo', () => {
|
|
const asset = { exifInfo: { fileSizeInByte: 200, rating: null, fNumber: undefined, description: '' } };
|
|
expect(getExifCount(asset as AssetResponseDto)).toBe(1);
|
|
});
|
|
|
|
it('returns the correct count when all exifInfo properties are non-null', () => {
|
|
const asset = { exifInfo: { fileSizeInByte: 200, rating: 5, fNumber: 1, description: 'test' } };
|
|
expect(getExifCount(asset as AssetResponseDto)).toBe(4);
|
|
});
|
|
});
|