package placement import ( "testing" libkg "haixun-backend/internal/library/knowledge" ) func TestEffectiveExpandStrategyFallsBackToLLMWithoutKey(t *testing.T) { research := ResearchSettings{ ExpandStrategy: string(libkg.ExpandStrategyBrave), WebSearchProvider: "brave", BraveAPIKey: "", } if got := EffectiveExpandStrategy(research); got != libkg.ExpandStrategyLLM { t.Fatalf("expected llm fallback, got %s", got) } } func TestEffectiveExpandStrategyKeepsBraveWithKey(t *testing.T) { research := ResearchSettings{ ExpandStrategy: string(libkg.ExpandStrategyBrave), WebSearchProvider: "brave", BraveAPIKey: "test-key", } if got := EffectiveExpandStrategy(research); got != libkg.ExpandStrategyBrave { t.Fatalf("expected brave, got %s", got) } } func TestWebSearchAvailable(t *testing.T) { if WebSearchAvailable(ResearchSettings{WebSearchProvider: "brave"}) { t.Fatal("expected unavailable without brave key") } if !WebSearchAvailable(ResearchSettings{WebSearchProvider: "brave", BraveAPIKey: "k"}) { t.Fatal("expected available with brave key") } }