mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-29 08:00:06 +00:00
454fc1a5f4
The assistant can now search a round hike of about a wished length from one point and the router's other ways for one leg of a hike, with the planner's own search, and propose each one as a hike card to compare and take. It can also search the user's wanderer trails, preview one as a card, import it and check a wanderer tour against its source. The round search, its loop geometry, the test whether two lines are one way, the other ways among a router's offers and the pins that hold a chosen way move to @trek/shared; the planner and the road trip use them from there.
35 lines
1.7 KiB
TypeScript
35 lines
1.7 KiB
TypeScript
// WANDERER-MCP-SCHEMA-001 to WANDERER-MCP-SCHEMA-002: the wanderer routes as the assistant asks them.
|
|
import {
|
|
wandererMcpImportRequestSchema,
|
|
wandererMcpPreviewRequestSchema,
|
|
wandererMcpSearchRequestSchema,
|
|
wandererMcpSourceRequestSchema,
|
|
} from './wanderer-mcp.schema';
|
|
|
|
import { describe, expect, it } from 'vitest';
|
|
|
|
describe('wanderer over MCP', () => {
|
|
it('WANDERER-MCP-SCHEMA-001: a search takes words, a page and a part of the map, nothing else', () => {
|
|
expect(wandererMcpSearchRequestSchema.parse({ q: ' Zugspitze ', page: 2 })).toEqual({ q: 'Zugspitze', page: 2 });
|
|
expect(wandererMcpSearchRequestSchema.parse({})).toEqual({});
|
|
expect(wandererMcpSearchRequestSchema.safeParse({ page: 26 }).success).toBe(false);
|
|
expect(
|
|
wandererMcpSearchRequestSchema.safeParse({ bbox: { south: 48, west: 11, north: 47, east: 12 } }).success,
|
|
).toBe(false);
|
|
expect(wandererMcpSearchRequestSchema.safeParse({ q: 'x', token: 'y' }).success).toBe(false);
|
|
});
|
|
|
|
it('WANDERER-MCP-SCHEMA-002: a preview, an import and a check name their trail or tour', () => {
|
|
expect(wandererMcpPreviewRequestSchema.safeParse({ trailId: 'abc' }).success).toBe(true);
|
|
expect(wandererMcpPreviewRequestSchema.safeParse({ trailId: '' }).success).toBe(false);
|
|
const hash = 'a'.repeat(32);
|
|
expect(wandererMcpImportRequestSchema.parse({ trailId: 'abc', contentHash: hash })).toEqual({
|
|
trailId: 'abc',
|
|
contentHash: hash,
|
|
});
|
|
expect(wandererMcpImportRequestSchema.safeParse({ trailId: 'abc', contentHash: 'short' }).success).toBe(false);
|
|
expect(wandererMcpSourceRequestSchema.safeParse({ placeId: 3 }).success).toBe(true);
|
|
expect(wandererMcpSourceRequestSchema.safeParse({ placeId: 0 }).success).toBe(false);
|
|
});
|
|
});
|