Files
vu/tests/calendar/january-sanctoral.test.ts
T
will f43f030a6a Fix ordinary-Sunday precedence and unify getDayLabel's commemoration rendering
Two related fixes surfaced while chasing why St. Gregory Thaumaturgus
appeared to be misdated on Nov 18:

- calendar/commemorations.ts's `ordinary-sunday` case was transferring a
  Semiduplex (or lower) saint off the Sunday instead of commemorating it
  in place — an earlier, unverified guess. Live-verified against both
  Tridentine 1906 and Divino Afflatu 1954 (St. Gregory Thaumaturgus, St.
  Clement, St. Apollinaris, St. Thomas Becket, all real cases): the saint
  stays and is commemorated on the Sunday itself, same as Simplex, never
  pushed to the next open day. This is what was actually moving Gregory
  onto Nov 18 — not a data error. `applyChristmasOctaveSunday`'s own
  Dec 26-29 special case needed a matching adjustment (per its own
  documented intent, the displaced saint there is deliberately *not*
  commemorated in place, since he reappears in full on Dec 30 instead).

- getDayLabel had five branches, each hand-assembling its own
  filter/format logic for which commemorations to show — which is why
  the octave phrasing, the closing-day title, and a missing Sunday
  commemoration turned into three separate bugs earlier instead of one.
  Replaced with a single shared `collectCommemorations` used by every
  branch. This also exposed that the sanctoral-winner branch never
  showed any commemorated saint at all, and every other branch only
  showed the *first* one (`.find()`), silently dropping real collisions
  — both now show every commemorated saint, matching this app's own
  generous-commemoration design.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 10:59:50 -04:00

70 lines
3.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { resolveDay } from '../../src/calendar';
import { getDayCollect } from '../../src/hours/resolve-common';
// 2029 — every January date below is a clean per-annum year for these
// saints (no Sunday collision), verified against Divinum Officium
// (Monastic Tridentinum 1617) — see data/calendar/saints/*.yml for the
// per-saint source detail.
describe('January sanctoral pull (first pass)', () => {
it('a saint with real authored propers wins outright and resolves a verified collect', () => {
const day = resolveDay('2029-01-16');
expect(day.winner).toEqual({
kind: 'sanctoral',
id: 'st-marcellus-i',
name: 'St. Marcellus I, Pope and Martyr',
rank: 'semiduplex',
});
const collect = getDayCollect(day);
expect(collect.status.en).toBe('verified');
expect(collect.text.en).toContain('Marcellus');
});
it('a saint with no unique propers (Common of Saints only) still wins outright, and resolves via the Common', () => {
const day = resolveDay('2026-01-17'); // St. Anthony Abbot
expect(day.winner).toEqual({
kind: 'sanctoral',
id: 'st-anthony-abbot',
name: 'St. Anthony, Abbot',
rank: 'duplex',
});
const collect = getDayCollect(day);
expect(collect.status.en).toBe('verified');
});
it('resolves a real multi-saint day as a winner plus a commemoration, not a collision error', () => {
const day = resolveDay('2029-01-18'); // Chair of St. Peter at Rome + St. Prisca
expect(day.winner).toEqual({
kind: 'sanctoral',
id: 'chair-of-st-peter-at-rome',
name: 'The Chair of St. Peter at Rome',
rank: 'duplex-majus',
});
expect(day.commemorations).toEqual([
{ kind: 'sanctoral', id: 'st-prisca', name: 'St. Prisca, Virgin and Martyr', rank: 'simplex' },
]);
});
it('a simplex saint on an ordinary Sunday is commemorated, not dropped or made to win', () => {
// Jan 14, 2029 is the Second Sunday after Epiphany (ordinary, not
// privileged) — St. Felix (simplex) is commemorated per the ordinary-
// Sunday rule, matching the historical calendar exactly. St. Hilary of
// Poitiers (Semiduplex, also native to this date) is commemorated too
// -- live-verified (Divino Afflatu 1954) as the real, sole
// commemoration named there; this app's own generous-commemoration
// design (see CLAUDE.md) additionally keeps St. Felix rather than
// dropping him now that Hilary no longer needs the day to himself.
const day = resolveDay('2029-01-14');
expect(day.winner).toEqual({ kind: 'temporal', id: 'post-epiphany-2' });
expect(day.commemorations).toEqual([
{
kind: 'sanctoral',
id: 'st-hilary-of-poitiers',
name: 'St. Hilary of Poitiers, Bishop, Confessor and Doctor of the Church',
rank: 'semiduplex',
},
{ kind: 'sanctoral', id: 'st-felix-presbyter', name: 'St. Felix, Priest and Martyr', rank: 'simplex' },
]);
});
});