mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 01:44:13 +00:00
73237ffedb
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.
68 lines
1.8 KiB
TypeScript
68 lines
1.8 KiB
TypeScript
import { vi } from 'vitest';
|
|
|
|
/**
|
|
* What a stubbed tour planner needs beyond the fields a test sets: a hike, no
|
|
* boat, no loop and the route tools as spies. Spread first, so a test's own
|
|
* fields win.
|
|
*/
|
|
export function hikePlannerDefaults() {
|
|
return {
|
|
tourType: 'hike' as const,
|
|
setTourType: vi.fn(),
|
|
isPaddle: false,
|
|
isBike: false,
|
|
bikeProfile: 'touring' as const,
|
|
setBikeProfile: vi.fn(),
|
|
unreachable: null,
|
|
paddle: {
|
|
boatType: null,
|
|
waterContext: null,
|
|
speedKmh: null,
|
|
portageSpeedKmh: null,
|
|
lakeStyle: 'direct' as const,
|
|
recommendedSpeedKmh: null,
|
|
effectiveSpeedKmh: null,
|
|
setBoatType: vi.fn(),
|
|
setWaterContext: vi.fn(),
|
|
setSpeedKmh: vi.fn(),
|
|
setPortageSpeedKmh: vi.fn(),
|
|
setLakeStyle: vi.fn(),
|
|
adoptRecommendedSpeed: vi.fn(),
|
|
load: vi.fn(),
|
|
},
|
|
paddleSpeedInvalid: false,
|
|
paddleIncomplete: false,
|
|
paddleEstimate: null,
|
|
editPaddlePoints: vi.fn(),
|
|
amendWaypoints: vi.fn(),
|
|
isLoop: false,
|
|
reverse: vi.fn(),
|
|
returnToStart: vi.fn(),
|
|
toggleWaypointFreeLeg: vi.fn(),
|
|
insertShapingPoint: vi.fn(() => null),
|
|
setWaypointShaping: vi.fn(),
|
|
recomputeLeg: vi.fn(),
|
|
routeDrawnLegsOnWater: vi.fn(),
|
|
paddleRoute: null,
|
|
routeCurrent: false,
|
|
routeParts: null,
|
|
mapOverlays: new Set<string>(),
|
|
toggleMapOverlay: vi.fn(),
|
|
tripId: 1,
|
|
editWaypoints: vi.fn(),
|
|
// P2C-03: a tour opened at its first revision, with nothing known about others.
|
|
revision: {
|
|
base: null,
|
|
baseRef: { current: null },
|
|
conflict: null,
|
|
remote: null,
|
|
adopt: vi.fn(),
|
|
notice: vi.fn(() => false),
|
|
refuse: vi.fn(() => false),
|
|
takeOver: vi.fn(),
|
|
dismissConflict: vi.fn(),
|
|
dismissRemote: vi.fn(),
|
|
},
|
|
};
|
|
}
|