fix(10-02): stabilize GitHubSource provider-name test

This commit is contained in:
salvacybersec
2026-04-06 01:15:51 +03:00
parent fb6cb53975
commit ab636dc5e1

View File

@@ -4,7 +4,6 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"errors" "errors"
"fmt"
"net/http" "net/http"
"net/http/httptest" "net/http/httptest"
"strings" "strings"
@@ -144,8 +143,8 @@ func TestGitHubSource_ProviderNameFromKeyword(t *testing.T) {
// Track which query came in so we can assert providerName mapping per-call. // Track which query came in so we can assert providerName mapping per-call.
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
q := r.URL.Query().Get("q") // Query contains spaces/quotes — don't interpolate it into JSON.
body := fmt.Sprintf(`{"items":[{"html_url":"https://example/%s","repository":{"full_name":"o/r"}}]}`, q) body := `{"items":[{"html_url":"https://example/x","repository":{"full_name":"o/r"}}]}`
w.Header().Set("Content-Type", "application/json") w.Header().Set("Content-Type", "application/json")
_, _ = w.Write([]byte(body)) _, _ = w.Write([]byte(body))
})) }))