mirror of
https://github.com/immich-app/immich.git
synced 2025-01-10 05:46:46 +01:00
1c2d83e2c7
* refactor(server): job handlers * chore: remove comment * chore: add comments for
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { assetEntityStub, authStub, newAssetRepositoryMock } from '../../test';
|
|
import { AssetService, IAssetRepository } from '../asset';
|
|
|
|
describe(AssetService.name, () => {
|
|
let sut: AssetService;
|
|
let assetMock: jest.Mocked<IAssetRepository>;
|
|
|
|
it('should work', () => {
|
|
expect(sut).toBeDefined();
|
|
});
|
|
|
|
beforeEach(async () => {
|
|
assetMock = newAssetRepositoryMock();
|
|
sut = new AssetService(assetMock);
|
|
});
|
|
|
|
describe('get map markers', () => {
|
|
it('should get geo information of assets', async () => {
|
|
assetMock.getMapMarkers.mockResolvedValue(
|
|
[assetEntityStub.withLocation].map((asset) => ({
|
|
id: asset.id,
|
|
|
|
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
lat: asset.exifInfo!.latitude!,
|
|
|
|
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
lon: asset.exifInfo!.longitude!,
|
|
})),
|
|
);
|
|
|
|
const markers = await sut.getMapMarkers(authStub.user1, {});
|
|
|
|
expect(markers).toHaveLength(1);
|
|
expect(markers[0]).toEqual({
|
|
id: assetEntityStub.withLocation.id,
|
|
lat: 100,
|
|
lon: 100,
|
|
});
|
|
});
|
|
});
|
|
});
|