mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 08:00:06 +00:00
fix(tours): a hike over several days reaches the router without its stage ends
The router checks its request against the strict plan point, which has no stage_end, so every hike with a stage end was refused with "Unrecognized key: stage_end" before a way was planned. The points go to the router with their position, name and kind only.
This commit is contained in:
@@ -48,6 +48,7 @@ import {
|
||||
type TourPoiSearchResponse,
|
||||
type UnroutedHikePlan,
|
||||
type WeatherResult,
|
||||
hikePlanRequestSchema,
|
||||
} from '@trek/shared';
|
||||
|
||||
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
@@ -649,6 +650,18 @@ describe('HikePlanMcp: propose_hike', () => {
|
||||
),
|
||||
).rejects.toThrow('a stage ends at a stop between start and end');
|
||||
});
|
||||
|
||||
it('HIKE-MCP-022b: the router gets the points without their stage ends, which its strict request refuses', async () => {
|
||||
const f = await fixture();
|
||||
const [first, middle, last] = WAYPOINTS;
|
||||
await mcp.proposeHike(
|
||||
{ tripId: f.trip.id, name: 'Two days', waypoints: [first, { ...middle, stage_end: true }, last] },
|
||||
ctx(f.user.id),
|
||||
);
|
||||
const sent = plan.mock.calls.at(-1)?.[2];
|
||||
expect(sent?.waypoints).toEqual(WAYPOINTS);
|
||||
expect(hikePlanRequestSchema.safeParse(sent).success).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('HikePlanMcp: create_hike', () => {
|
||||
|
||||
Reference in New Issue
Block a user