refactor: 解决无法正确加载 .env 的问题
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestLoad(t *testing.T) {
|
||||
cfg, err := Load()
|
||||
if err != nil {
|
||||
t.Fatalf("Load() failed: %v", err)
|
||||
}
|
||||
|
||||
if cfg.Server.Port == "" {
|
||||
t.Error("Expected Server.Port to have default value")
|
||||
}
|
||||
|
||||
if cfg.LLM.Provider == "" && cfg.LLM.APIKey == "" {
|
||||
t.Logf("Config loaded - some optional values may be empty (expected if .env not found)")
|
||||
} else {
|
||||
t.Logf("Config loaded successfully. Provider: %s, Model: %s",
|
||||
cfg.LLM.Provider, cfg.LLM.Model)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user