From 25249749ad8fcf7d75bd69c1bb7c52c523eb156a Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 4 Sep 2026 19:54:08 +0200 Subject: [PATCH] test(planner): give the page fixture the road trip state it reads The page reaches into routeAlternatives.open, roadtripRoutes.lines and roadtripVias.byDay before it ever asks whether road trip mode is on, so a fixture without them took all 47 wiring cases down with "Cannot read properties of undefined". The mode stays off, which is the state every assertion here is written against. --- .../src/pages/TripPlannerPage.wiring.test.tsx | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/client/src/pages/TripPlannerPage.wiring.test.tsx b/client/src/pages/TripPlannerPage.wiring.test.tsx index 6430106d4..d081f8ccc 100644 --- a/client/src/pages/TripPlannerPage.wiring.test.tsx +++ b/client/src/pages/TripPlannerPage.wiring.test.tsx @@ -141,6 +141,37 @@ function baseState(): HookState { collabFeatures: { chat: true, notes: true, polls: true, whatsnext: true }, tripAccommodations: [], setTripAccommodations: vi.fn(), + // Road trip mode off, which is the state every assertion below reads: the page keeps + // its ordinary map, sidebar and route wiring, and the road-trip branches stay unmounted. + // The shapes still have to be here, because the page reaches into routeAlternatives.open, + // roadtripRoutes.lines and roadtripVias.byDay before it ever checks whether the mode is on. + roadtripMode: false, + toggleRoadtripMode: vi.fn(), + roadtripActive: false, + roadtripRoutes: { lines: [], segments: [], days: [], loading: false, totalStops: 0 }, + roadtripCorridor: { visible: [], day: null, dayId: '', setDayId: vi.fn(), categories: [], toggleCategory: vi.fn(), widthKm: 5, setWidthKm: vi.fn(), search: vi.fn(), nameFilter: '', setNameFilter: vi.fn(), insertIndexFor: vi.fn() }, + stopDraft: null, + setStopDraft: vi.fn(), + saveStopDraft: vi.fn(async () => undefined), + stopDraftToForm: vi.fn(), + stopDraftDuplicate: null, + reorderRoadtripStop: vi.fn(async () => undefined), + roadtripVias: { byDay: {}, refresh: vi.fn(async () => undefined) }, + addRoadtripVia: vi.fn(async () => undefined), + moveRoadtripVia: vi.fn(async () => undefined), + removeRoadtripVia: vi.fn(async () => undefined), + routeAlternatives: { open: null, close: vi.fn(), loading: false, ask: vi.fn(async () => undefined) }, + askRouteAlternatives: vi.fn(async () => undefined), + chooseRouteAlternative: vi.fn(async () => undefined), + alternativeOverlays: [], + alternativeFocusPoints: [], + stayDraft: null, + setStayDraft: vi.fn(), + setRoadtripStay: vi.fn(async () => undefined), + highlightedAlternative: null, + setHighlightedAlternative: vi.fn(), + moveRoadtripStopToDay: vi.fn(async () => undefined), + dropPoiOnRoute: vi.fn(async () => undefined), allowedFileTypes: 'pdf', tripMembers: [], setTripMembers: vi.fn(),