mirror of
https://github.com/immich-app/immich.git
synced 2026-04-25 02:29:51 -04:00
24 lines
908 B
TypeScript
24 lines
908 B
TypeScript
import { mapAlbum } from 'src/dtos/album.dto';
|
|
import { AlbumFactory } from 'test/factories/album.factory';
|
|
import { getForAlbum } from 'test/mappers';
|
|
|
|
describe('mapAlbum', () => {
|
|
it('should set start and end dates', () => {
|
|
const startDate = new Date('2023-02-22T05:06:29.716Z');
|
|
const endDate = new Date('2025-01-01T01:02:03.456Z');
|
|
const album = AlbumFactory.from()
|
|
.asset({ localDateTime: endDate }, (builder) => builder.exif())
|
|
.asset({ localDateTime: startDate }, (builder) => builder.exif())
|
|
.build();
|
|
const dto = mapAlbum(getForAlbum(album));
|
|
expect(dto.startDate).toEqual(startDate);
|
|
expect(dto.endDate).toEqual(endDate);
|
|
});
|
|
|
|
it('should not set start and end dates for empty assets', () => {
|
|
const dto = mapAlbum(getForAlbum(AlbumFactory.create()));
|
|
expect(dto.startDate).toBeUndefined();
|
|
expect(dto.endDate).toBeUndefined();
|
|
});
|
|
});
|