test: add env override validation when config file is missing
This commit is contained in:
parent
34c68a7bff
commit
0e2580ea64
1 changed files with 16 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -13,6 +14,21 @@ func TestDefaultConfig_HeartbeatEnabled(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestLoadConfig_EnvOverridesWithoutFile ensures env vars are applied when the config file is missing.
|
||||
func TestLoadConfig_EnvOverridesWithoutFile(t *testing.T) {
|
||||
t.Setenv("PICOCLAW_AGENTS_DEFAULTS_MODEL", "env-model")
|
||||
|
||||
missing := filepath.Join(t.TempDir(), "missing.json")
|
||||
cfg, err := LoadConfig(missing)
|
||||
if err != nil {
|
||||
t.Fatalf("expected no error, got %v", err)
|
||||
}
|
||||
|
||||
if got := cfg.Agents.Defaults.Model; got != "env-model" {
|
||||
t.Fatalf("expected model from env, got %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
// TestDefaultConfig_WorkspacePath verifies workspace path is correctly set
|
||||
func TestDefaultConfig_WorkspacePath(t *testing.T) {
|
||||
cfg := DefaultConfig()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue