This commit is contained in:
Andras Schmelczer 2026-05-06 23:13:58 +01:00
parent 94f9c0d594
commit 5c3b87f2d5
69 changed files with 1334 additions and 213 deletions

View file

@ -34,6 +34,17 @@ const busStop: POI = {
emoji: '🚌',
};
const foodWarehouse: POI = {
id: 'poi-4',
name: 'Iceland Avonmead Food Warehouse',
category: 'Iceland',
icon_category: 'The Food Warehouse',
group: 'Groceries',
lat: 51.49,
lng: -0.18,
emoji: '🛒',
};
function layerById(layers: readonly unknown[], id: string) {
const layer = layers.find((item) => (item as { id?: string }).id === id);
if (!layer) throw new Error(`Layer ${id} not found`);
@ -62,8 +73,18 @@ describe('usePoiLayers', () => {
const iconLayer = layerById(result.current.poiLayers, 'poi-icons');
const getIcon = iconLayer.props.getIcon as (poi: POI) => { url: string };
expect(getIcon(waitrose).url).toBe(
'https://geolytix.github.io/MapIcons/brands/waitrose_24px.svg'
expect(getIcon(waitrose).url).toBe('/assets/poi-icons/brands/waitrose_24px.svg');
});
it('prefers POI fascia icon categories for map marker icons', () => {
const { result } = renderHook(() =>
usePoiLayers({ pois: [foodWarehouse], zoom: 15, isDark: false })
);
const iconLayer = layerById(result.current.poiLayers, 'poi-icons');
const getIcon = iconLayer.props.getIcon as (poi: POI) => { url: string };
expect(getIcon(foodWarehouse).url).toBe(
'/assets/poi-icons/brands/iceland_food_warehouse_24px.svg'
);
});
@ -99,6 +120,7 @@ describe('usePoiLayers', () => {
y: 88,
name: supermarket.name,
category: supermarket.category,
icon_category: undefined,
group: supermarket.group,
emoji: supermarket.emoji,
id: supermarket.id,