feat: rank growth events with grounded evidence
This commit is contained in:
@@ -33,6 +33,22 @@ func TestAnalyzeEventEffectSuppressesSmallBaseline(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMostRecentExactOccurrenceRequiresOccasionAndVariant(t *testing.T) {
|
||||
t.Parallel()
|
||||
upcoming := Event{ID: "black-friday-2026", OccasionKey: "black-friday", EventVariant: "CAMPAIGN_WINDOW", StartDate: time.Date(2026, 11, 27, 0, 0, 0, 0, time.UTC)}
|
||||
catalog := []Event{
|
||||
{ID: "wrong-variant", OccasionKey: "black-friday", EventVariant: "PRIMARY", StartDate: time.Date(2025, 11, 28, 0, 0, 0, 0, time.UTC), EndDate: time.Date(2025, 11, 28, 0, 0, 0, 0, time.UTC)},
|
||||
{ID: "old", OccasionKey: "black-friday", EventVariant: "CAMPAIGN_WINDOW", StartDate: time.Date(2024, 11, 29, 0, 0, 0, 0, time.UTC), EndDate: time.Date(2024, 11, 29, 0, 0, 0, 0, time.UTC)},
|
||||
{ID: "recent", OccasionKey: "black-friday", EventVariant: "CAMPAIGN_WINDOW", StartDate: time.Date(2025, 11, 28, 0, 0, 0, 0, time.UTC), EndDate: time.Date(2025, 11, 28, 0, 0, 0, 0, time.UTC)},
|
||||
{ID: "wrong-key", OccasionKey: "cyber-monday", EventVariant: "CAMPAIGN_WINDOW", StartDate: time.Date(2025, 12, 1, 0, 0, 0, 0, time.UTC), EndDate: time.Date(2025, 12, 1, 0, 0, 0, 0, time.UTC)},
|
||||
}
|
||||
|
||||
got, ok := MostRecentExactOccurrence(upcoming, catalog)
|
||||
if !ok || got.ID != "recent" {
|
||||
t.Fatalf("MostRecentExactOccurrence() = (%+v, %v), want recent exact occurrence", got, ok)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMatchUpcomingEventsPrefersFamilyThenTags(t *testing.T) {
|
||||
historical := Event{ID: "teacher", Family: "appreciation", Tags: []string{"gift", "education"}}
|
||||
upcoming := []Event{
|
||||
|
||||
Reference in New Issue
Block a user