From 3677ad490c9f18020d68349c9e3a71bcf389178f Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 27 Jul 2026 12:18:01 +0200 Subject: feat(calendar): temporal cycle (seasons, Sundays, movable solemnities) --- internal/calendar/temporal_test.go | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 internal/calendar/temporal_test.go (limited to 'internal/calendar/temporal_test.go') diff --git a/internal/calendar/temporal_test.go b/internal/calendar/temporal_test.go new file mode 100644 index 0000000..da871a2 --- /dev/null +++ b/internal/calendar/temporal_test.go @@ -0,0 +1,53 @@ +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") + } +} -- cgit v1.3