fix: deliver validated AI insight responses
This commit is contained in:
@@ -46,6 +46,28 @@ func TestMatchUpcomingEventsPrefersFamilyThenTags(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildOpportunitiesReturnsThreeNearestCommercialEventsWithoutHistoricalWins(t *testing.T) {
|
||||
start := date("2026-08-21")
|
||||
forecast := Forecast{Confidence: ConfidenceMedium}
|
||||
for day := start; day.Before(start.AddDate(0, 0, 120)); day = day.AddDate(0, 0, 1) {
|
||||
forecast.Points = append(forecast.Points, ForecastPoint{
|
||||
Date: day, PaidSessions: Range{P10: 80, P50: 100, P90: 120},
|
||||
PaidAmountRial: Range{P10: 800, P50: 1000, P90: 1200},
|
||||
})
|
||||
}
|
||||
catalog := filterCatalog(testCatalog(), "مراکز آموزشی مجازی")
|
||||
got := buildOpportunities(nil, catalog, forecast, start, 3)
|
||||
if len(got) != 3 {
|
||||
t.Fatalf("got %d opportunities, want 3: %+v", len(got), got)
|
||||
}
|
||||
want := []string{"back-to-school-1405", "autumn-opening-1405", "halloween-2026"}
|
||||
for index, id := range want {
|
||||
if got[index].EventID != id {
|
||||
t.Fatalf("opportunity %d = %q, want %q", index, got[index].EventID, id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestBuildForecastReturnsOrderedNinetyDayIntegerRanges(t *testing.T) {
|
||||
start := date("2026-07-01")
|
||||
history := make([]DailyPoint, 0, 112)
|
||||
|
||||
Reference in New Issue
Block a user