From 8cddd445ba41122a6f902480dfb9b6c957fea55f Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 13 Sep 2026 23:32:35 +0200 Subject: [PATCH] test(roadtrip): the assemble spec holds up under shared's stricter typecheck noUncheckedIndexedAccess makes every index access optional, DriveLimits wants its two minute ceilings named even when they are null, and the distance unit is metric/imperial rather than a unit label. --- shared/src/roadtrip/assemble.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/src/roadtrip/assemble.spec.ts b/shared/src/roadtrip/assemble.spec.ts index 80bb6aeff..21223a8d1 100644 --- a/shared/src/roadtrip/assemble.spec.ts +++ b/shared/src/roadtrip/assemble.spec.ts @@ -56,19 +56,19 @@ function assemble(stops: RoadtripStop[], legs: number[]) { const day: PlanDay = { dayId: 1, dayNumber: 1, date: '2026-06-01', title: null, stops }; const allLegs: Record = {}; legs.forEach((km, i) => { - allLegs[legKey(stops[i], stops[i + 1])] = leg(km); + allLegs[legKey(stops[i]!, stops[i + 1]!)] = leg(km); }); return assembleRoadtrip({ plan: [day], quietDays: [], window: null, - distanceUnit: 'km', + distanceUnit: 'metric', allLegs, snapByDay: {}, missedByDay: {}, loading: false, // 600 km on a full battery, and no daily driving ceiling to muddy the warnings. - limits: { rangeKm: 600 }, + limits: { rangeKm: 600, legMinutes: null, dayMinutes: null }, vehicleKind: 'electric', connectDays: false, boundaries: [], @@ -77,7 +77,7 @@ function assemble(stops: RoadtripStop[], legs: number[]) { } const rangeWarnings = (routes: ReturnType) => - routes.days[0].driveWarnings.filter((w) => w.code === 'range'); + routes.days[0]!.driveWarnings.filter((w) => w.code === 'range'); describe('assembleRoadtrip drive warnings', () => { it('ROADTRIP-ASSEMBLE-001: a charger at the end of an out-of-range leg answers for it', () => {