mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-22 15:06:32 +00:00
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.
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user