mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-30 08:30:05 +00:00
feat(tours): bike tours in the planner, CyclOSM, and the planned cards' last points (BIK-01 to BIK-06, RTE-01, IO-01, LIB-02)
The tour type is a dropdown; a bike tour picks its profile, routes for it, says when a point lies off every way, and shows what it runs on: surfaces, kinds of way and, for a mountain bike, the trail grades, each pointed at on the map. A type's own map (OpenHikingMap for a hike, CyclOSM for a bike tour) is offered while a tour of that type is open, with an admin switch each. From the planned cards: a hike avoids steep climbs, steps or ferries, nothing else; a saved tour can be shared where the platform takes GPX files; and the tours rail adds a tour from one menu: plan new, import GPX, or take one over from another trip.
This commit is contained in:
@@ -1,9 +1,24 @@
|
||||
import { act, renderHook } from '@testing-library/react';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { useTileHealth, useTourRasterOverlay } from './useTourRasterOverlay';
|
||||
import { useBaseMapHealth, useTileHealth, useTourRasterOverlay } from './useTourRasterOverlay';
|
||||
|
||||
const SEAMARKS = { id: 'seamarks', url: 'https://x/{z}/{x}/{y}.png', attribution: 'x', minZoom: 6, maxZoom: 18 };
|
||||
|
||||
describe('useBaseMapHealth (MAP-01, BIK-06)', () => {
|
||||
it('watches a map on terms only, names it, and asks afresh when another becomes the base map', () => {
|
||||
const { result, rerender } = renderHook((layer: string) => useBaseMapHealth(layer), { initialProps: 'topo' });
|
||||
expect(result.current).toBeUndefined();
|
||||
rerender('cycle');
|
||||
expect(result.current).toMatchObject({ base: 'cycle', down: false });
|
||||
act(() => {
|
||||
for (let i = 0; i < 4; i += 1) result.current?.onTileError();
|
||||
});
|
||||
expect(result.current?.down).toBe(true);
|
||||
rerender('hiking');
|
||||
expect(result.current).toMatchObject({ base: 'hiking', down: false });
|
||||
});
|
||||
});
|
||||
|
||||
describe('useTileHealth', () => {
|
||||
it('counts a source down after a run of failures, never after a stray one, and up again on one tile', () => {
|
||||
const { result } = renderHook(() => useTileHealth());
|
||||
|
||||
Reference in New Issue
Block a user