fix: anchor growth forecasts to real Tehran date
This commit is contained in:
39
internal/eventcatalog/catalog_test.go
Normal file
39
internal/eventcatalog/catalog_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
package eventcatalog
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestResolveBlackFridayUsesRecurrenceRule(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
got, err := ResolveRecurrence(RecurrenceBlackFriday, 2026, time.UTC)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if want := "2026-11-27"; got.Format(time.DateOnly) != want {
|
||||
t.Fatalf("Black Friday = %s, want %s", got.Format(time.DateOnly), want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateEventsDistinguishesCelebrationAndMourning(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
events := []Event{
|
||||
{ID: "nowruz-1405", TitleFA: "نوروز", StartDate: "2026-03-21", EndDate: "2026-03-24", Type: TypeCultural, Tone: ToneCelebratory, CommercialPosture: PosturePromote, SourceURI: "https://calendar.ut.ac.ir/", SourceVersion: "1405", InclusionRationale: "تقویم رسمی", GeographicScope: "IR", RelevanceBPS: 10000, ConfidenceBPS: 10000},
|
||||
{ID: "ashura-1405", TitleFA: "عاشورای حسینی", StartDate: "2026-06-25", EndDate: "2026-06-25", Type: TypeReligious, Tone: ToneMourning, CommercialPosture: PostureNoPromotion, SourceURI: "https://calendar.ut.ac.ir/", SourceVersion: "1405", InclusionRationale: "تقویم رسمی", GeographicScope: "IR", RelevanceBPS: 10000, ConfidenceBPS: 10000},
|
||||
}
|
||||
if err := ValidateEvents(events); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidateEventsRejectsPromotionalMourningEvent(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
event := Event{ID: "mourning", TitleFA: "یادبود", StartDate: "2026-01-01", EndDate: "2026-01-01", Type: TypeCultural, Tone: ToneMourning, CommercialPosture: PosturePromote, SourceURI: "https://example.test", SourceVersion: "v1", InclusionRationale: "reviewed", GeographicScope: "IR", RelevanceBPS: 10000, ConfidenceBPS: 10000}
|
||||
if err := ValidateEvents([]Event{event}); err == nil {
|
||||
t.Fatal("expected mourning promotion validation error")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user