(t *testing.T)
| 190 | } |
| 191 | |
| 192 | func TestLoadAgentConfig(t *testing.T) { |
| 193 | // Create a temp file |
| 194 | tmpDir := t.TempDir() |
| 195 | configPath := filepath.Join(tmpDir, "agent.yaml") |
| 196 | |
| 197 | configContent := ` |
| 198 | template_id: "test-template" |
| 199 | template_version: "1.0.0" |
| 200 | model_config: |
| 201 | provider: "anthropic" |
| 202 | model: "claude-3-5-sonnet" |
| 203 | ` |
| 204 | |
| 205 | err := os.WriteFile(configPath, []byte(configContent), 0644) |
| 206 | if err != nil { |
| 207 | t.Fatalf("failed to write test config: %v", err) |
| 208 | } |
| 209 | |
| 210 | loader := NewLoader() |
| 211 | config, err := loader.LoadAgentConfig(configPath) |
| 212 | if err != nil { |
| 213 | t.Fatalf("LoadAgentConfig failed: %v", err) |
| 214 | } |
| 215 | |
| 216 | if config.TemplateID != "test-template" { |
| 217 | t.Errorf("expected template_id 'test-template', got %q", config.TemplateID) |
| 218 | } |
| 219 | if config.TemplateVersion != "1.0.0" { |
| 220 | t.Errorf("expected template_version '1.0.0', got %q", config.TemplateVersion) |
| 221 | } |
| 222 | if config.ModelConfig.Provider != "anthropic" { |
| 223 | t.Errorf("expected provider 'anthropic', got %q", config.ModelConfig.Provider) |
| 224 | } |
| 225 | } |
| 226 | |
| 227 | func TestLoadAgentConfigWithEnvVars(t *testing.T) { |
| 228 | _ = os.Setenv("TEST_API_KEY", "sk-env-key") |
nothing calls this directly
no test coverage detected