mirror of
https://github.com/Dvorinka/Devour.git
synced 2026-06-03 20:13:03 +00:00
update
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package cmd
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestInferLanguageFromText_UsesTokenBoundaries(t *testing.T) {
|
||||
if got := inferLanguageFromText("get nextjs docs"); got != "nextjs" {
|
||||
t.Fatalf("inferLanguageFromText matched %q, want %q", got, "nextjs")
|
||||
}
|
||||
if got := inferLanguageFromText("read docs for architecture"); got != "" {
|
||||
t.Fatalf("inferLanguageFromText should not infer language from plain docs text, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestClassifyIntent_GetRouteKeywordFallback(t *testing.T) {
|
||||
decision, err := classifyIntent("get nextjs docs", "")
|
||||
if err != nil {
|
||||
t.Fatalf("classifyIntent returned error: %v", err)
|
||||
}
|
||||
if decision.Route != "get" {
|
||||
t.Fatalf("expected get route, got %q", decision.Route)
|
||||
}
|
||||
if len(decision.Command) != 3 {
|
||||
t.Fatalf("expected 3 command args, got %v", decision.Command)
|
||||
}
|
||||
if decision.Command[1] != "nextjs" {
|
||||
t.Fatalf("expected language nextjs, got %q", decision.Command[1])
|
||||
}
|
||||
if decision.Command[2] != "overview" {
|
||||
t.Fatalf("expected keyword overview, got %q", decision.Command[2])
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user