27 lines
803 B
Go
27 lines
803 B
Go
package backend
|
|
|
|
import (
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
)
|
|
|
|
func TestParseConfigFileCompactionModel(t *testing.T) {
|
|
path := filepath.Join(t.TempDir(), "backends.conf")
|
|
content := "backend = openrouter\n\n[openrouter]\nmodel = primary\ncompactionModel = compact\n\n[ollama]\nmodel = local\n"
|
|
if err := os.WriteFile(path, []byte(content), 0600); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
cfg := parseConfigFile(path)
|
|
if got := cfg.Backends["openrouter"].CompactionModel; got != "compact" {
|
|
t.Fatalf("openrouter compactionModel = %q, want %q", got, "compact")
|
|
}
|
|
if got := cfg.Backends["ollama"].CompactionModel; got != "" {
|
|
t.Fatalf("ollama compactionModel = %q, want empty", got)
|
|
}
|
|
if got := cfg.Backends["ollama"].Model; got != "local" {
|
|
t.Fatalf("ollama model = %q, want %q", got, "local")
|
|
}
|
|
}
|