From d7b1019308831ee2acd07c46602272777d0d4ead Mon Sep 17 00:00:00 2001 From: Miguel Raposo Date: Fri, 29 May 2026 11:04:43 +0100 Subject: [PATCH] refactor(web): cleaner code and better names for the tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Afonso Mendonça Ribeiro --- .../lib/components/shared-components/map/Map.svelte | 2 +- ...ntegration.spec.ts => clusters-integration.spec.ts} | 0 .../map/__tests__/{map-utils.spec.ts => utils.spec.ts} | 2 +- .../shared-components/map/{map-utils.ts => utils.ts} | 0 .../managers/timeline-manager/timeline-month.svelte.ts | 10 +++++----- 5 files changed, 7 insertions(+), 7 deletions(-) rename web/src/lib/components/shared-components/map/__tests__/{map-cluster-integration.spec.ts => clusters-integration.spec.ts} (100%) rename web/src/lib/components/shared-components/map/__tests__/{map-utils.spec.ts => utils.spec.ts} (99%) rename web/src/lib/components/shared-components/map/{map-utils.ts => utils.ts} (100%) diff --git a/web/src/lib/components/shared-components/map/Map.svelte b/web/src/lib/components/shared-components/map/Map.svelte index 7e49fe7f21..fb7c67bda4 100644 --- a/web/src/lib/components/shared-components/map/Map.svelte +++ b/web/src/lib/components/shared-components/map/Map.svelte @@ -51,7 +51,7 @@ import { t } from 'svelte-i18n'; import { GeoJSON, HeatmapLayer, MapLibre, MarkerLayer, Popup } from 'svelte-maplibre'; import type { SelectionBBox } from './types'; - import { autoZoomCluster } from './map-utils'; + import { autoZoomCluster } from './utils'; interface Props { mapMarkers?: MapMarkerResponseDto[]; diff --git a/web/src/lib/components/shared-components/map/__tests__/map-cluster-integration.spec.ts b/web/src/lib/components/shared-components/map/__tests__/clusters-integration.spec.ts similarity index 100% rename from web/src/lib/components/shared-components/map/__tests__/map-cluster-integration.spec.ts rename to web/src/lib/components/shared-components/map/__tests__/clusters-integration.spec.ts diff --git a/web/src/lib/components/shared-components/map/__tests__/map-utils.spec.ts b/web/src/lib/components/shared-components/map/__tests__/utils.spec.ts similarity index 99% rename from web/src/lib/components/shared-components/map/__tests__/map-utils.spec.ts rename to web/src/lib/components/shared-components/map/__tests__/utils.spec.ts index cc9f925645..c44da1af85 100644 --- a/web/src/lib/components/shared-components/map/__tests__/map-utils.spec.ts +++ b/web/src/lib/components/shared-components/map/__tests__/utils.spec.ts @@ -2,7 +2,7 @@ import type { Feature, Point } from 'geojson'; import type { GeoJSONSource, Map } from 'maplibre-gl'; import type { Mock } from 'vitest'; import { describe, it, expect, vi, beforeEach } from 'vitest'; -import { autoZoomCluster } from '../map-utils'; +import { autoZoomCluster } from '../utils'; /** * Unit tests for the autoZoomCluster function diff --git a/web/src/lib/components/shared-components/map/map-utils.ts b/web/src/lib/components/shared-components/map/utils.ts similarity index 100% rename from web/src/lib/components/shared-components/map/map-utils.ts rename to web/src/lib/components/shared-components/map/utils.ts diff --git a/web/src/lib/managers/timeline-manager/timeline-month.svelte.ts b/web/src/lib/managers/timeline-manager/timeline-month.svelte.ts index 2a2b2fde07..cbbb4ea73e 100644 --- a/web/src/lib/managers/timeline-manager/timeline-month.svelte.ts +++ b/web/src/lib/managers/timeline-manager/timeline-month.svelte.ts @@ -190,17 +190,17 @@ export class TimelineMonth { isVideo: !(bucketAssets.isImage?.[i] ?? true), livePhotoVideoId: bucketAssets.livePhotoVideoId?.[i] ?? null, localDateTime, - createdAt: fromISODateTimeUTC(bucketAssets.createdAt[i]).setZone('local'), + createdAt: fromISODateTimeUTC(bucketAssets.createdAt?.[i] ?? bucketAssets.fileCreatedAt[i]).setZone('local'), fileCreatedAt, ownerId: bucketAssets.ownerId?.[i] ?? '', projectionType: bucketAssets.projectionType?.[i] ?? null, ratio: bucketAssets.ratio?.[i] ?? 1, stack: bucketAssets.stack?.[i] ? { - id: bucketAssets.stack[i]![0], - primaryAssetId: bucketAssets.id[i], - assetCount: Number.parseInt(bucketAssets.stack[i]![1]), - } + id: bucketAssets.stack[i]![0], + primaryAssetId: bucketAssets.id[i], + assetCount: Number.parseInt(bucketAssets.stack[i]![1]), + } : null, thumbhash: bucketAssets.thumbhash?.[i] ?? null, people: null, // People are not included in the bucket assets