summaryrefslogtreecommitdiff
path: root/internal/llm/copilot_http_test.go
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2025-09-06 10:25:36 +0300
committerPaul Buetow <paul@buetow.org>2025-09-06 10:25:36 +0300
commit5be9532cfa630f4aacd8d879c3e4f5cc316da0fa (patch)
tree0a901680fccd1e2703ffdbd9284ccff932be1d67 /internal/llm/copilot_http_test.go
parent70f1d0e78c57dfa5beae779b3d392b6e6fa44c14 (diff)
feat(lsp): configurable inline/chat triggers; switch inline markers to >text>/>>text>; update docs and example config; tests updated to new triggers and raise LSP coverage to >=85%; chore: remove semicolon legacy; chore(mage): auto-refresh coverage daily if docs/coverage.out is older than 24h
Diffstat (limited to 'internal/llm/copilot_http_test.go')
-rw-r--r--internal/llm/copilot_http_test.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/internal/llm/copilot_http_test.go b/internal/llm/copilot_http_test.go
index 53f831c..180e43e 100644
--- a/internal/llm/copilot_http_test.go
+++ b/internal/llm/copilot_http_test.go
@@ -10,12 +10,14 @@ import (
"testing"
"time"
"encoding/base64"
+ "os"
)
type rtFunc2 func(*http.Request) (*http.Response, error)
func (f rtFunc2) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) }
func TestCopilot_EnsureSession_AndChat_Success(t *testing.T) {
+ if os.Getenv("HEXAI_TEST_SKIP_NET") == "1" { t.Skip("skip network-bound tests in restricted environments") }
// Mock chat endpoint
chatSrv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/chat/completions" { t.Fatalf("unexpected path: %s", r.URL.Path) }
@@ -73,6 +75,7 @@ func TestCopilot_CodeCompletion_Success(t *testing.T) {
}
func TestCopilot_Chat_MultiChoice_And_ErrorBody(t *testing.T) {
+ if os.Getenv("HEXAI_TEST_SKIP_NET") == "1" { t.Skip("skip network-bound tests in restricted environments") }
// Chat multi-choice: return two choices; client returns first content
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_ = json.NewEncoder(w).Encode(map[string]any{
@@ -109,6 +112,7 @@ func TestCopilot_Chat_MultiChoice_And_ErrorBody(t *testing.T) {
}
func TestCopilot_Chat_NoChoices_Error(t *testing.T) {
+ if os.Getenv("HEXAI_TEST_SKIP_NET") == "1" { t.Skip("skip network-bound tests in restricted environments") }
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_ = json.NewEncoder(w).Encode(map[string]any{"choices": []any{}})
}))
@@ -127,6 +131,7 @@ func TestCopilot_Chat_NoChoices_Error(t *testing.T) {
}
func TestCopilot_Chat_DecodeError_StatusOK(t *testing.T) {
+ if os.Getenv("HEXAI_TEST_SKIP_NET") == "1" { t.Skip("skip network-bound tests in restricted environments") }
// Chat returns 200 but invalid JSON; expect decode error
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
io.WriteString(w, "{invalid")