package server import ( "testing" "gophergate/internal/router" ) func TestIsSoftwareDevelopment(t *testing.T) { tests := []struct { message string expected bool }{ {"can you check the logs? it looks like a lot of requests are being routed to kimi-k2.7-code when they don't need to be", false}, {"it looks like its still routing to kimi when it shouldn't need to", false}, {"Write a python script to parse logs", true}, {"Search the web for weather in New York", false}, {"How to build a compiler in Go", true}, {"Check my vscode config", false}, {"Let's decode this barcode", false}, {"go ahead and email both docxs and the ppt to kayla\n\n... HELPipedia_Telethon_Speaker_Script.docx ... mental health program specialist ...", false}, {"academic program development", false}, {"write a script for the video presentation", false}, {"How to write a bash script", true}, {"refactor this sql query", true}, {"can you organize Downloads and Documents real quick?\n\n\nCLI wrapper: ~/Projects/rag-engine/rag (bash script activating .venv). Python venv@~/Projects/rag-engine/.venv/.\n", false}, } for _, tt := range tests { result := isSoftwareDevelopment(tt.message) if result != tt.expected { t.Errorf("isSoftwareDevelopment(%q) = %v; expected %v", tt.message, result, tt.expected) } } } func TestGetRouteCtxTags(t *testing.T) { s := &Server{} tests := []struct { name string routeCtx *router.RouteContext expectedTags []string mustContain []string mustExclude []string }{ { name: "Standard query with tools", routeCtx: &router.RouteContext{ UserMessage: "Search the web for weather in Paris", RequiresToolCalling: true, }, mustExclude: []string{"tool-heavy", "swe-bench"}, }, { name: "Coding query with tools", routeCtx: &router.RouteContext{ UserMessage: "Write a python script to parse logs", RequiresToolCalling: true, IsSoftwareDevelopment: true, }, mustContain: []string{"tool-heavy", "swe-bench"}, }, { name: "Agent query with tools", routeCtx: &router.RouteContext{ UserMessage: "agent please orchestrate the multi-agent task", RequiresToolCalling: true, }, mustContain: []string{"tool-heavy", "swe-bench"}, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { tags := s.getRouteCtxTags(tt.routeCtx) for _, expected := range tt.mustContain { found := false for _, tag := range tags { if tag == expected { found = true break } } if !found { t.Errorf("expected tag %q to be present, but was not in %v", expected, tags) } } for _, excluded := range tt.mustExclude { for _, tag := range tags { if tag == excluded { t.Errorf("expected tag %q to be excluded, but was found in %v", excluded, tags) } } } }) } }