mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-24 16:03:02 +00:00
164a3633ac
Ski becomes "Ski & winter", a type the planner plans with six disciplines (alpine, snowboard, cross-country, ski touring, snowshoeing, winter hiking), nothing preselected; saving needs a discipline, and a technique for cross-country. Every leg is drawn straight between the points through planner/skiRouting.ts, the one place the piste router will plug in, with its heights from the elevation source and no ski time worked out. The hike's winter label goes entirely: its migration, column, field, marks, GPX rule, MCP field and strings. A hike is summer only; a ski tour with the snowshoe discipline exports as snowshoeing. The unreleased ski migration takes the six disciplines and the collection migration loses the winter column. The pistes are offered for a ski tour, shown until switched off, and with no tour open, never for a hike. Export, copy, collections, stages (untimed), actual tracks, the atlas, list and day marks (one glyph per discipline), 3D, planning over a ski import and list_tours/get_tour_plan know the planned ski tour.
131 lines
3.6 KiB
TypeScript
131 lines
3.6 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,
|
|
isHorse: false,
|
|
bikeProfile: 'touring' as const,
|
|
setBikeProfile: vi.fn(),
|
|
// SKI-02: no ski tour, so no discipline chosen nor asked for.
|
|
isSki: false,
|
|
ski: { choice: { discipline: null, technique: null }, change: vi.fn(), load: vi.fn() },
|
|
skiMissing: null,
|
|
// RUN-01: no run, so no pace asked for.
|
|
isRun: false,
|
|
runProfile: 'running' as const,
|
|
setRunProfile: vi.fn(),
|
|
runPace: { paceSecondsPerKm: null, setPace: vi.fn(), load: vi.fn() },
|
|
runPaceMissing: false,
|
|
runPaceInvalid: false,
|
|
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),
|
|
insertShapingPoints: vi.fn(() => null),
|
|
setWaypointShaping: vi.fn(),
|
|
recomputeLeg: vi.fn(),
|
|
routeDrawnLegsOnWater: vi.fn(),
|
|
legVariants: idleLegVariants(),
|
|
roundHikes: idleRoundHikes(),
|
|
paddleRoute: null,
|
|
routeCurrent: false,
|
|
routeParts: null,
|
|
mapOverlays: new Set<string>(),
|
|
mapOverlaysOff: new Set<string>(),
|
|
toggleMapOverlay: vi.fn(),
|
|
tripId: 1,
|
|
editWaypoints: vi.fn(),
|
|
// CW-07: a draft planned in TREK, not read from a Google Maps walk.
|
|
draftSource: null,
|
|
// MDT-01: a day tour, no stage set and none that may be.
|
|
stages: {
|
|
multiDay: false,
|
|
stages: [],
|
|
endCount: 0,
|
|
lost: 0,
|
|
setMultiDay: vi.fn(),
|
|
toggleStageEnd: vi.fn(),
|
|
canEnd: vi.fn(() => false),
|
|
},
|
|
// 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(),
|
|
},
|
|
};
|
|
}
|
|
|
|
/** RTE-02: a planner comparing no section, with its actions as spies. */
|
|
export function idleLegVariants() {
|
|
return {
|
|
comparison: null,
|
|
focus: null,
|
|
canCompare: vi.fn(() => false),
|
|
compare: vi.fn(),
|
|
select: vi.fn(),
|
|
hover: vi.fn(),
|
|
apply: vi.fn(),
|
|
close: vi.fn(),
|
|
appliedHint: { shown: false, key: null, undo: vi.fn(), hold: vi.fn() },
|
|
};
|
|
}
|
|
|
|
/** RTE-03: a planner offering no round hike, with its actions as spies. */
|
|
export function idleRoundHikes() {
|
|
return {
|
|
view: null,
|
|
focus: null,
|
|
frame: null,
|
|
canStart: vi.fn(() => false),
|
|
open: vi.fn(),
|
|
find: vi.fn(),
|
|
back: vi.fn(),
|
|
select: vi.fn(),
|
|
hover: vi.fn(),
|
|
apply: vi.fn(),
|
|
confirm: vi.fn(),
|
|
cancelConfirm: vi.fn(),
|
|
close: vi.fn(),
|
|
appliedHint: { shown: false, key: null, undo: vi.fn(), hold: vi.fn() },
|
|
};
|
|
}
|