From 9b5ce6a6ffc8d9ff10ae8d2c384efd91de8d2b76 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Thu, 4 Sep 2025 08:54:18 +0300 Subject: tests: fix hexaicli OpenAI-key dependent tests; add lsp code action and helper tests; ignore coverage artifacts --- internal/hexaicli/run_test.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'internal/hexaicli/run_test.go') diff --git a/internal/hexaicli/run_test.go b/internal/hexaicli/run_test.go index 3fe59fb..69fe089 100644 --- a/internal/hexaicli/run_test.go +++ b/internal/hexaicli/run_test.go @@ -87,6 +87,9 @@ func TestRun_OpenAI_NoKey_ShowsError(t *testing.T) { // write config with provider=openai writeJSON(t, filepath.Join(dir, "hexai", "config.json"), map[string]any{"provider":"openai", "openai_model":"gpt-x"}) t.Setenv("XDG_CONFIG_HOME", dir) + // Ensure no OpenAI API key is present in environment + t.Setenv("HEXAI_OPENAI_API_KEY", "") + t.Setenv("OPENAI_API_KEY", "") var out, errb bytes.Buffer // Run expects parsed flags; here args irrelevant err := Run(context.Background(), []string{"hello"}, strings.NewReader(""), &out, &errb) @@ -110,6 +113,8 @@ func TestNewClientFromConfig_Ollama(t *testing.T) { func TestNewClientFromConfig_OpenAI_MissingKey(t *testing.T) { cfg := appconfig.App{ Provider: "openai", OpenAIBaseURL: "https://api", OpenAIModel: "gpt" } + t.Setenv("HEXAI_OPENAI_API_KEY", "") + t.Setenv("OPENAI_API_KEY", "") if _, err := newClientFromConfig(cfg); err == nil { t.Fatalf("expected error for missing openai key") } -- cgit v1.2.3