feat: add configurable AgentRouter AI provider
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
package growthreport
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -9,6 +11,34 @@ import (
|
||||
"git.amiirkhl.ir/starcoach-hackathon/zarinpal-analytics-backend/internal/growth"
|
||||
)
|
||||
|
||||
func TestEvidenceToolsReturnsUnavailableForKnownEventWithoutPlaybook(t *testing.T) {
|
||||
t.Parallel()
|
||||
tools := NewEvidenceTools(Analysis{
|
||||
Evidence: Evidence{Events: []UpcomingEvent{{EvidenceID: "event:known"}}},
|
||||
Fallback: &AICopy{},
|
||||
})
|
||||
|
||||
got, err := tools.Execute(context.Background(), "get_campaign_playbook", json.RawMessage(`{"evidenceId":"event:known"}`))
|
||||
if err != nil {
|
||||
t.Fatalf("Execute() error = %v, want an explicit unavailable result", err)
|
||||
}
|
||||
if string(got) != `{"state":"UNAVAILABLE","reason":"NO_PLAYBOOK"}` {
|
||||
t.Fatalf("Execute() = %s", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEvidenceToolsRejectsUnknownPlaybookEvidence(t *testing.T) {
|
||||
t.Parallel()
|
||||
tools := NewEvidenceTools(Analysis{
|
||||
Evidence: Evidence{Events: []UpcomingEvent{{EvidenceID: "event:known"}}},
|
||||
Fallback: &AICopy{},
|
||||
})
|
||||
|
||||
if _, err := tools.Execute(context.Background(), "get_campaign_playbook", json.RawMessage(`{"evidenceId":"event:unknown"}`)); err == nil {
|
||||
t.Fatal("Execute() error = nil, want unknown evidence error")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpcomingEventsKeepsFiveChronologicalEligibleCandidates(t *testing.T) {
|
||||
t.Parallel()
|
||||
start := time.Date(2026, time.August, 22, 0, 0, 0, 0, time.UTC)
|
||||
|
||||
Reference in New Issue
Block a user