test(places): cover the place sheet sections, tags, trip lists and the visited filter

This commit is contained in:
Maurice
2026-11-29 21:16:39 +01:00
parent d008331e5f
commit c944ef6de5
60 changed files with 4182 additions and 44 deletions
@@ -1,7 +1,7 @@
// FE-COMP-POIAPPEAR-001 to FE-COMP-POIAPPEAR-005
// FE-COMP-POIAPPEAR-001 to FE-COMP-POIAPPEAR-007
import { describe, it, expect } from 'vitest'
import { Coffee, Fuel, MapPin, Signpost } from 'lucide-react'
import { poiAppearance, POI_CATEGORIES, ROADTRIP_POI_CATEGORIES } from './poiCategories'
import { Bookmark, Coffee, Fuel, Heart, MapPin, Signpost } from 'lucide-react'
import { poiAppearance, POI_CATEGORIES, ROADTRIP_POI_CATEGORIES, SAVED_PLACE_POI_CATEGORY } from './poiCategories'
import { POI_DEFAULT_COLOR } from './pluginPoiIcons'
const PLUGIN_KEY = 'plugin:trail-finder/trailheads'
@@ -31,4 +31,15 @@ describe('poiAppearance', () => {
expect(poiAppearance({ category, color: '#2f855a', icon: 'Signpost' })).toEqual({ color: POI_DEFAULT_COLOR, Icon: null })
}
})
it('FE-COMP-POIAPPEAR-006: a saved place of a linked list wears the list symbol in the list colour', () => {
expect(SAVED_PLACE_POI_CATEGORY).toBe('saved-place')
expect(poiAppearance({ category: SAVED_PLACE_POI_CATEGORY, color: '#E11D48', icon: 'Heart' })).toEqual({ color: '#E11D48', Icon: Heart })
})
it('FE-COMP-POIAPPEAR-007: a saved place without a valid #rrggbb colour or known symbol falls back to the accent and a bookmark', () => {
for (const color of [undefined, '', 'red', '#fff', '#12345g', 'var(--x)']) {
expect(poiAppearance({ category: SAVED_PLACE_POI_CATEGORY, color }).color).toBe('var(--accent)')
}
expect(poiAppearance({ category: SAVED_PLACE_POI_CATEGORY, icon: 'NoSuchIcon' }).Icon).toBe(Bookmark)
})
})