MCPcopy Index your code
hub / github.com/BlockRunAI/ClawRouter / testRoute

Function testRoute

test/e2e.ts:514–528  ·  view source on GitHub ↗
(prompt: string, label: string, expectedTier?: string)

Source from the content-addressed store, hash-verified

512};
513
514async function testRoute(prompt: string, label: string, expectedTier?: string) {
515 const decision = await route(prompt, undefined, 4096, routerOpts);
516 const savingsPct = (decision.savings * 100).toFixed(1);
517 if (expectedTier) {
518 assert(
519 decision.tier === expectedTier,
520 `${label} → ${decision.model} (${decision.tier}, ${decision.method}) saved=${savingsPct}%`,
521 );
522 } else {
523 console.log(
524 ` → ${label} → ${decision.model} (${decision.tier}, ${decision.method}) saved=${savingsPct}%`,
525 );
526 }
527 return decision;
528}
529
530await testRoute("What is the capital of France?", "Simple factual", "SIMPLE");
531await testRoute("Hello, how are you?", "Greeting", "SIMPLE");

Callers 1

e2e.tsFile · 0.85

Calls 2

routeFunction · 0.85
assertFunction · 0.70

Tested by

no test coverage detected