diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 23:27:07 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-07-27 23:27:07 +0200 |
| commit | 4a35093c4358be17da6f0f374197caed743bda26 (patch) | |
| tree | d0b4298cae6738632437923a64fda0463efbe658 /internal/caldata/of_test.go | |
| parent | 5d765444f315ee512c5ceb9bcf83730be8112b60 (diff) | |
| download | lectio-4a35093c4358be17da6f0f374197caed743bda26.tar.gz lectio-4a35093c4358be17da6f0f374197caed743bda26.zip | |
feat(caldata): OF Sunday/solemnity readings by slug+cycle (seed table)
Diffstat (limited to 'internal/caldata/of_test.go')
| -rw-r--r-- | internal/caldata/of_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/internal/caldata/of_test.go b/internal/caldata/of_test.go new file mode 100644 index 0000000..7bc2ce1 --- /dev/null +++ b/internal/caldata/of_test.go @@ -0,0 +1,38 @@ +package caldata + +import ( + "testing" + "time" + + "github.com/lukaszkasprzak/lectio/internal/calendar" +) + +func TestOFReadingsByCycle(t *testing.T) { + // A synthetic OF day keyed christ-the-king-A must resolve to Matt 25. + day := calendar.LiturgicalDay{ + Observed: calendar.Celebration{Slug: "christ-the-king", Layer: "temporal"}, + SundayCycle: "A", + Weekday: time.Sunday, + } + sel := calendar.Selection{Form: "new"} + rs := Readings(sel, nil, time.Date(2026, 11, 22, 0, 0, 0, 0, time.UTC), day) + var gospel string + for _, r := range rs { + if r.Part == "gospel" { + gospel = r.Citation + } + } + if gospel == "" || gospel[:4] != "Matt" { + t.Fatalf("christ-the-king-A gospel = %q, want Matt…", gospel) + } +} + +func TestOFWeekdayEmpty(t *testing.T) { + day := calendar.LiturgicalDay{ + Observed: calendar.Celebration{Slug: "ordinary-weekday", Layer: "temporal"}, + Weekday: time.Wednesday, // no SundayCycle key -> deferred phase -> empty + } + if rs := Readings(calendar.Selection{Form: "new"}, nil, time.Now().UTC(), day); len(rs) != 0 { + t.Fatalf("weekday should be empty, got %v", rs) + } +} |
