diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cf48d1b6d..7468612ec 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1202,7 +1202,7 @@ jobs: docker stop -t 30 trek-ci >/dev/null code="$(docker inspect -f '{{.State.ExitCode}}' trek-ci)" [ "$code" = "0" ] || { echo "::error::docker stop ended with exit code $code, not a graceful shutdown"; exit 1; } - docker logs trek-ci 2>&1 | grep -q 'SIGTERM received' \ + docker logs trek-ci 2>&1 | grep 'SIGTERM received' >/dev/null \ || { echo "::error::the server never saw SIGTERM"; exit 1; } - name: Container log diff --git a/client/src/components/Map/RouteCalculator.ts b/client/src/components/Map/RouteCalculator.ts index 2cd585eb3..2df83f3ee 100644 --- a/client/src/components/Map/RouteCalculator.ts +++ b/client/src/components/Map/RouteCalculator.ts @@ -217,7 +217,12 @@ export function parsePluginProfile(profile: string): { pluginId: string; profile /** One of the three profiles both engines know, or null for a plugin's own. */ function builtInProfile(profile: RouteProfileKey): 'driving' | 'walking' | 'cycling' | null { - return profile === 'driving' || profile === 'walking' || profile === 'cycling' ? profile : null + switch (profile) { + case 'driving': return 'driving' + case 'walking': return 'walking' + case 'cycling': return 'cycling' + default: return null + } } /** diff --git a/client/src/components/Map/valhallaRoute.ts b/client/src/components/Map/valhallaRoute.ts index 7ceec5e37..d610c0ddd 100644 --- a/client/src/components/Map/valhallaRoute.ts +++ b/client/src/components/Map/valhallaRoute.ts @@ -738,7 +738,8 @@ async function requestRun( ): Promise | ValhallaNoPath | TooSlow | null> { const body = routeBody(waypoints, profile, avoid, costingOptions, searchFilter) const data = await postRoute(base, body, signal, publicFallback) - if (data === NO_PATH || tooSlow(data)) return data + if (data === NO_PATH) return NO_PATH + if (tooSlow(data)) return data return data === null ? null : runFrom(data) } diff --git a/client/src/components/Roadtrip/useRoadtripRoutes.test.ts b/client/src/components/Roadtrip/useRoadtripRoutes.test.ts index 01397bd4c..bac86a128 100644 --- a/client/src/components/Roadtrip/useRoadtripRoutes.test.ts +++ b/client/src/components/Roadtrip/useRoadtripRoutes.test.ts @@ -1182,11 +1182,11 @@ describe('a leg asked for again on demand', () => { const { result } = renderHook(() => useRoadtripRoutes(7, [day(1, 1)], map(1, [{ id: 1, at: HAMBURG }, { id: 2, at: BERLIN }]))) await waitFor(() => expect(result.current.loading).toBe(false)) const [from, to] = result.current.days[0].stops - expect(result.current.legRouter!(from, to, 1)).toMatchObject({ engine: 'osrm', standIn: false }) + expect(result.current.legRouter?.(from, to, 1)).toMatchObject({ engine: 'osrm', standIn: false }) calculateRouteWithLegs.mockResolvedValue({ ...routed(1), engine: 'valhalla' }) - act(() => { result.current.reroute!() }) - await waitFor(() => expect(result.current.legRouter!(from, to, 1).engine).toBe('valhalla')) + act(() => { result.current.reroute?.() }) + await waitFor(() => expect(result.current.legRouter?.(from, to, 1)?.engine).toBe('valhalla')) }) it('FE-ROADTRIP-ROUTES-048: a day the stand-in engine drove while avoiding says the avoidance did not happen', async () => {