Lint
This commit is contained in:
parent
94f9c0d594
commit
5c3b87f2d5
69 changed files with 1334 additions and 213 deletions
|
|
@ -1,9 +1,12 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import { existsSync } from 'fs';
|
||||
import { join } from 'path';
|
||||
|
||||
import {
|
||||
DENSITY_GRADIENT,
|
||||
ENUM_PALETTE,
|
||||
FEATURE_GRADIENT,
|
||||
POI_CATEGORY_LOGOS,
|
||||
SMALLEST_VISIBLE_HEXAGON_RESOLUTION,
|
||||
} from './consts';
|
||||
import {
|
||||
|
|
@ -52,12 +55,25 @@ describe('map utilities', () => {
|
|||
});
|
||||
|
||||
it('prefers POI category logos before falling back to emoji icons', () => {
|
||||
expect(getPoiIconUrl('Waitrose', '🛒')).toBe(
|
||||
'https://geolytix.github.io/MapIcons/brands/waitrose_24px.svg'
|
||||
expect(getPoiIconUrl('Waitrose', '🛒')).toBe('/assets/poi-icons/brands/waitrose_24px.svg');
|
||||
expect(getPoiIconUrl('Iceland', '🛒', 'The Food Warehouse')).toBe(
|
||||
'/assets/poi-icons/brands/iceland_food_warehouse_24px.svg'
|
||||
);
|
||||
expect(getPoiIconUrl("Sainsbury's", '🛒', undefined, 'Sainsburys Earlsfield Local')).toBe(
|
||||
'/assets/poi-icons/brands/sainsburys_local_24px.svg'
|
||||
);
|
||||
expect(getPoiIconUrl('Unknown category', '🛒')).toBe('/assets/twemoji/1f6d2.png');
|
||||
});
|
||||
|
||||
it('keeps POI icon URLs bundled locally', () => {
|
||||
expect(Object.values(POI_CATEGORY_LOGOS).filter((url) => /^https?:\/\//.test(url))).toEqual([]);
|
||||
expect(
|
||||
Object.values(POI_CATEGORY_LOGOS)
|
||||
.filter((url) => url.startsWith('/assets/poi-icons/'))
|
||||
.filter((url) => !existsSync(join(process.cwd(), 'public', url.slice(1))))
|
||||
).toEqual([]);
|
||||
});
|
||||
|
||||
it('returns fallback, filtered, enum, feature, and density colors', () => {
|
||||
expect(
|
||||
getFeatureFillColor(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue