diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 12:18:01 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 12:18:01 +0200 |
| commit | 3677ad490c9f18020d68349c9e3a71bcf389178f (patch) | |
| tree | 3a4b135ca139a2acca15ac0f9f5cf851d88a45dd /internal/calendar/temporal_test.go | |
| parent | 7e2d958f4855a92b8f349e553979e098fdb0a04c (diff) | |
| download | lectio-3677ad490c9f18020d68349c9e3a71bcf389178f.tar.gz lectio-3677ad490c9f18020d68349c9e3a71bcf389178f.zip | |
feat(calendar): temporal cycle (seasons, Sundays, movable solemnities)
Diffstat (limited to 'internal/calendar/temporal_test.go')
| -rw-r--r-- | internal/calendar/temporal_test.go | 53 |
1 files changed, 53 insertions, 0 deletions
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") + } +} |
