package calendar import ( "testing" "time" ) func d(s string) time.Time { t, _ := time.Parse("2006-01-02", s) return t.UTC() } func TestTemporalSeasons(t *testing.T) { sel := DefaultSelection() cases := []struct { date string season Season }{ {"2025-12-01", Advent}, // Mon after Advent I (2025 Advent I = Nov 30) {"2025-12-25", Christmas}, // Christmas {"2025-03-05", Lent}, // Ash Wednesday 2025 {"2025-04-20", Easter_}, // Easter Sunday 2025 {"2025-07-15", Ordinary}, // deep Ordinary Time } for _, c := range cases { got := temporal(d(c.date), sel) if got.Season != c.season { t.Errorf("temporal(%s).Season = %s, want %s", c.date, got.Season, c.season) } } } func TestTemporalPrivilegedSunday(t *testing.T) { // 2nd Sunday of Advent 2025 (Dec 7) is privileged and violet. td := temporal(d("2025-12-07"), DefaultSelection()) if !td.Privileged { t.Error("Sunday of Advent must be privileged") } if td.Colour != Violet { t.Errorf("Advent colour = %s want violet", td.Colour) } } func TestMovableSolemnities(t *testing.T) { // Corpus Christi 2025 (Thursday, easter+60) = 2025-06-19. td := temporal(d("2025-06-19"), DefaultSelection()) if td.Cel.Slug != "corpus-christi" { t.Errorf("2025-06-19 temporal slug = %q want corpus-christi", td.Cel.Slug) } if td.Rank != RankSolemnity { t.Error("Corpus Christi must be a solemnity") } }