41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
|
|
package knowledge
|
||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
func TestExpandStrategyUsesSupplementalBrave(t *testing.T) {
|
||
|
|
if !ExpandStrategyBrave.UsesSupplementalBrave() {
|
||
|
|
t.Fatal("brave should use supplemental brave")
|
||
|
|
}
|
||
|
|
if ExpandStrategyHybrid.UsesSupplementalBrave() {
|
||
|
|
t.Fatal("hybrid should skip supplemental brave")
|
||
|
|
}
|
||
|
|
if ExpandStrategyLLM.UsesSupplementalBrave() {
|
||
|
|
t.Fatal("llm should skip supplemental brave")
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestParseExpandStrategy(t *testing.T) {
|
||
|
|
cases := map[string]ExpandStrategy{
|
||
|
|
"": ExpandStrategyBrave,
|
||
|
|
"brave": ExpandStrategyBrave,
|
||
|
|
"BRAVE": ExpandStrategyBrave,
|
||
|
|
"llm": ExpandStrategyLLM,
|
||
|
|
"hybrid": ExpandStrategyHybrid,
|
||
|
|
"unknown": ExpandStrategyBrave,
|
||
|
|
}
|
||
|
|
for raw, want := range cases {
|
||
|
|
if got := ParseExpandStrategy(raw); got != want {
|
||
|
|
t.Fatalf("ParseExpandStrategy(%q) = %q, want %q", raw, got, want)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestExpandStrategyRequiresBrave(t *testing.T) {
|
||
|
|
if !ExpandStrategyBrave.RequiresBrave() || !ExpandStrategyHybrid.RequiresBrave() {
|
||
|
|
t.Fatal("brave/hybrid should require brave")
|
||
|
|
}
|
||
|
|
if ExpandStrategyLLM.RequiresBrave() {
|
||
|
|
t.Fatal("llm should not require brave")
|
||
|
|
}
|
||
|
|
}
|