summaryrefslogtreecommitdiff
path: root/internal/config/config_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-04-22 09:07:47 +0300
committerPaul Buetow <paul@buetow.org>2026-04-22 09:07:47 +0300
commit519be7e7dd12cbe3c85f90cf06d65b377eb22a3c (patch)
tree59bc012999bd03a26e5fa6c097741ede7b211296 /internal/config/config_test.go
parent24dd98eaa9759884b17f18c729d498af6ec70e9e (diff)
add logo
Diffstat (limited to 'internal/config/config_test.go')
-rw-r--r--internal/config/config_test.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/internal/config/config_test.go b/internal/config/config_test.go
index f825f58..1a53486 100644
--- a/internal/config/config_test.go
+++ b/internal/config/config_test.go
@@ -101,6 +101,33 @@ narration:
}
}
+func TestLoadFallsBackToGoogleAPIKeyEnv(t *testing.T) {
+ t.Setenv("GOOGLE_API_KEY", "fallback-key")
+
+ cfg, err := Load("")
+ if err != nil {
+ t.Fatalf("Load() error = %v", err)
+ }
+
+ if got, want := cfg.GoogleAPIKey(), "fallback-key"; got != want {
+ t.Fatalf("GoogleAPIKey() = %q, want %q", got, want)
+ }
+}
+
+func TestLoadPrefersComicForgeGoogleAPIKeyEnv(t *testing.T) {
+ t.Setenv("GOOGLE_API_KEY", "fallback-key")
+ t.Setenv("COMICFORGE_API_GOOGLE_API_KEY", "comicforge-key")
+
+ cfg, err := Load("")
+ if err != nil {
+ t.Fatalf("Load() error = %v", err)
+ }
+
+ if got, want := cfg.GoogleAPIKey(), "comicforge-key"; got != want {
+ t.Fatalf("GoogleAPIKey() = %q, want %q", got, want)
+ }
+}
+
func TestRenderPrompt(t *testing.T) {
tmpDir := t.TempDir()
cfg := DefaultConfig()