fix: use available bounded research search provider
CI / test (push) Successful in 51s
CI / test (pull_request) Successful in 53s

This commit is contained in:
m
2026-08-24 02:15:03 +03:00
parent c09be4c9b5
commit 00d7f70ffb
5 changed files with 46 additions and 4 deletions
@@ -39,3 +39,16 @@ func TestSearchConnectorRejectsUnallowlistedEndpoint(t *testing.T) {
t.Fatalf("expected allowlist rejection, got %v", err)
}
}
func TestSearchConnectorParsesConfiguredBingStyleResults(t *testing.T) {
server := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
_, _ = w.Write([]byte(`<li class="b_algo"><h2><a href="https://source.example">Source title</a></h2><p>Current source excerpt</p></li>`))
}))
defer server.Close()
request := epistemics.WebSearchRequest{Plan: epistemics.ResearchPlan{ID: "plan", Question: "q", SourceClasses: []string{"web-search"}, FreshnessPolicy: "current"}, PropositionKey: "p", Query: "q"}
connector := researchadapter.SearchConnector{EndpointTemplate: server.URL + "?q=%s", AllowedHosts: map[string]struct{}{"127.0.0.1": {}}, Client: server.Client(), MaxResults: 3}
candidates, err := connector.Collect(context.Background(), request, 10)
if err != nil || len(candidates) != 1 || candidates[0].Statement != "Source title — Current source excerpt" {
t.Fatalf("unexpected Bing-style evidence: candidates=%+v err=%v", candidates, err)
}
}