Files
TREK/client/tests/helpers/storeRegistry.ts
T
Maurice 03d6457bde feat(tours): paddle obstacle card, admin regions panel and obstacle marks on the route band
PAD-05B: a click on an obstacle on the map or on the route band opens its card in the look of the via ferrata card: the kind with its glyph, the name, how it stands to the route (on it at a distance along it, near it with the link marked unclear, or only in the area), the paddling rule its tags give with canoe read before boat, a condition as written, height, grade, hours and fees, the source with the date of the data and the OpenStreetMap link. A missing rule reads as unknown, never as allowed, and a portage way recorded as private says so. Objects only in the area show from zoom 13 on, on Leaflet and GL alike; on GL the lines only near the route are dashed as on Leaflet, one click handler picks the marker over the line, and a picked marker no longer flickers. The route band marks the obstacles on and near the route by their share of the measured line. The obstacle notice also names an answer cut at its limit.

PAD-05A: the admin area gets a Paddle water data card under the addons, on desktop and phone: a search in Geofabrik's list with each region's path, the regions with their state (waiting, reading with its progress, ready with objects and data date, failed with the reason), reading again and removing after a confirmation. The list follows a read without reloading. Region changes write audit rows.

Map colours of paddle objects and portages come from theme tokens read at draw time, as the via ferratas do; the ferrata layer now shares that reader. The rail takes the planner page's parts as one bag, the map hit tests of the tour layers are one helper, and the unused noWaterData string is gone from every locale.
2026-10-16 23:03:09 +00:00

63 lines
2.9 KiB
TypeScript

import type { StoreApi } from 'zustand';
import { useAddonStore } from '../../src/store/addonStore';
import { useAuthStore } from '../../src/store/authStore';
import { useInAppNotificationStore } from '../../src/store/inAppNotificationStore';
import { usePaddleObstacleStore } from '../../src/store/paddleObstacleStore';
import { usePermissionsStore } from '../../src/store/permissionsStore';
import { useSettingsStore } from '../../src/store/settingsStore';
import { useTourMapVisibilityStore } from '../../src/store/tourMapVisibilityStore';
import { useTrackMarkToolStore } from '../../src/store/trackMarkToolStore';
import { useTripStore } from '../../src/store/tripStore';
import { useVacayStore } from '../../src/store/vacayStore';
/**
* Every Zustand store in src/, and what resetAllStores does with it.
*
* RESET_STORES are put back to the state they had when this module was first
* imported, before any test touched them. UNRESET_STORES are left alone, each
* with the reason; their tests reset them on their own. The registry test
* (tests/unit/helpers/storeRegistry.test.ts) finds every `export const
* use…Store = create…` under src/ and fails on one that is in neither list,
* so a new store has to be placed here instead of being forgotten by the
* reset and leaking state from one test into the next.
*
* The stores are imported by name rather than through a glob: an eager glob
* would load every store module into each of the hundreds of test files that
* reset, including the ones that mock a store module or import it in a
* particular order (journeyStore), and a store moved from UNRESET to RESET
* changes what those files start from. Each such move is its own change.
*/
type ResettableStore = Pick<StoreApi<object>, 'getState' | 'setState'>;
export const RESET_STORES: Record<string, ResettableStore> = {
useAuthStore,
useTripStore,
useSettingsStore,
useVacayStore,
useAddonStore,
useInAppNotificationStore,
usePermissionsStore,
useTourMapVisibilityStore,
usePaddleObstacleStore,
useTrackMarkToolStore,
};
/** Not reset so far; moving one into RESET_STORES changes what every file that resets starts from. */
const NOT_YET = 'never reset by resetAllStores; its own tests set the state they need';
export const UNRESET_STORES: Record<string, string> = {
useJourneyStore: 'reset in the journey tests themselves; importing it here pulls in a circular import',
useBackgroundTasksStore: NOT_YET,
useCollectionStore: NOT_YET,
useDocSyncOfferStore: NOT_YET,
useHelpStore: NOT_YET,
usePluginStore: NOT_YET,
useRoadtripPreferencesStore: NOT_YET,
useSaveToCollectionStore: NOT_YET,
useServerVersionStore: NOT_YET,
useStudioStore: NOT_YET,
useSystemNoticeStore: NOT_YET,
useTourFerrataCrossingStore: 'set by the tour map stage; the tests that read it reset it in their own beforeEach',
useTourPlaceToolStore: 'reset in the tour tests themselves to initialTourPlaceToolState()',
};