1package configv2
2
3import (
4 "fmt"
5 "os"
6 "testing"
7
8 "github.com/stretchr/testify/assert"
9)
10
11func resetEnvVars() {
12 os.Setenv("ANTHROPIC_API_KEY", "")
13 os.Setenv("OPENAI_API_KEY", "")
14 os.Setenv("GEMINI_API_KEY", "")
15 os.Setenv("XAI_API_KEY", "")
16 os.Setenv("OPENROUTER_API_KEY", "")
17}
18
19func TestConfigWithEnv(t *testing.T) {
20 resetEnvVars()
21 testConfigDir = t.TempDir()
22
23 cwdDir := t.TempDir()
24
25 os.Setenv("ANTHROPIC_API_KEY", "test-anthropic-key")
26 os.Setenv("OPENAI_API_KEY", "test-openai-key")
27 os.Setenv("GEMINI_API_KEY", "test-gemini-key")
28 os.Setenv("XAI_API_KEY", "test-xai-key")
29 os.Setenv("OPENROUTER_API_KEY", "test-openrouter-key")
30 cfg := InitConfig(cwdDir)
31 fmt.Println(cfg)
32 assert.Len(t, cfg.Providers, 5)
33}