MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestMatchSubsystemRoutes

Function TestMatchSubsystemRoutes

cmd/hooks_test.go:594–625  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

592}
593
594func TestMatchSubsystemRoutes(t *testing.T) {
595 cfg := config.ProjectConfig{
596 Routing: config.RoutingConfig{
597 Retrieval: config.RetrievalConfig{Strategy: "keyword", TopK: 2},
598 Subsystems: []config.Subsystem{
599 {
600 ID: "watching",
601 Keywords: []string{"hook", "daemon", "events"},
602 Docs: []string{"docs/HOOKS.md"},
603 Agents: []string{"codemap-hook-triage"},
604 },
605 {
606 ID: "handoff",
607 Keywords: []string{"handoff", "delta"},
608 Docs: []string{"README.md"},
609 },
610 },
611 },
612 }
613
614 prompt := "the daemon hook events log is too noisy, handoff delta might also be stale"
615 matches := matchSubsystemRoutes(prompt, cfg, cfg.RoutingTopKOrDefault())
616 if len(matches) != 2 {
617 t.Fatalf("expected top_k=2 matches, got %d: %+v", len(matches), matches)
618 }
619 if matches[0].ID != "watching" {
620 t.Fatalf("expected highest score route to be watching, got %+v", matches[0])
621 }
622 if len(matches[0].Docs) != 1 || matches[0].Docs[0] != "docs/HOOKS.md" {
623 t.Fatalf("unexpected watching docs: %+v", matches[0].Docs)
624 }
625}
626
627// TestHubInfoWithMultipleHubs tests scenarios with multiple hub files
628func TestHubInfoWithMultipleHubs(t *testing.T) {

Callers

nothing calls this directly

Calls 2

RoutingTopKOrDefaultMethod · 0.95
matchSubsystemRoutesFunction · 0.85

Tested by

no test coverage detected