feat(places): export normalizeOsrmSteps from sources/places so any route proxy serves Directions' turn-by-turn steps

This commit is contained in:
Sameh Khamis committed 2026-11-17 21:05:20 -08:00
1 parent fa6ae42525
commit c1ca67bdb1
5 files changed
+23 -3

No files matched your search

+4
View File
@@ -1,3 +1,7 @@
// Turn-by-turn steps for a route, as Core's own /api/route serves them with
// steps=1; a hosted route proxy projects the same OSRM answer.
export { normalizeOsrmSteps } from './routeSteps.js';
function placeContextPriority(types) {
const typeSet = new Set(types);
if (typeSet.has('historical_landmark') || typeSet.has('monument')) return 100;
+9 -1
View File
@@ -11,7 +11,11 @@ import {
_routeInflightCountForTest,
_setRouteUpstreamIntervalForTest,
} from '../../server/providers/places/routes.js';
import { ROUTE_STEPS_MAX } from '../../src/data/routeSteps.js';
import {
ROUTE_STEPS_MAX,
normalizeOsrmSteps,
} from '../../src/data/routeSteps.js';
import * as placePayloads from '../../src/data/placeProviderPayloads.js';
import {
projectNearbyPlaces,
projectTextSearchPlaces,
@@ -465,6 +469,10 @@ test('identical concurrent route requests make one upstream call', async (t) =>
);
});
test('the place payloads entry serves the same route steps the dev proxy does', () => {
assert.equal(placePayloads.normalizeOsrmSteps, normalizeOsrmSteps);
});
test('a pathological maneuver count is bounded before it reaches the browser', async (t) => {
_resetRouteUpstreamForTest();
const request = install(installRouteMiddleware);