Files
vu/tests/calendar/july-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.5 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { resolveDay } from '../../src/calendar';
import { getDayCollect } from '../../src/hours/resolve-common';
// Clean per-annum years for these dates (no Sunday collision) — see
// data/calendar/saints/*.yml for per-saint source detail.
describe('July sanctoral pull (first pass)', () => {
it('St. James the Greater wins outright at Duplex II. classis with a real proper collect, beating a genuinely unwinnable stub', () => {
const day = resolveDay('2028-07-25');
expect(day.winner).toEqual({
kind: 'sanctoral',
id: 'st-james-the-greater',
name: 'St. James the Greater, Apostle',
rank: 'duplex-2-classis',
});
expect(day.commemorations).toEqual([
{ kind: 'sanctoral', id: 'st-christopher', name: 'St. Christopher, Martyr', rank: 'simplex' },
]);
expect(getDayCollect(day).status.en).toBe('verified');
});
it('an earlier live-query pass mis-recorded St. Apollinaris under the wrong date (a transfer artifact) — his real date is the 23rd', () => {
const day = resolveDay('2026-07-23'); // a clean year, no Sunday collision
expect(day.winner).toEqual({
kind: 'sanctoral',
id: 'st-apollinaris',
name: 'St. Apollinaris, Bishop and Martyr',
rank: 'semiduplex',
});
expect(day.commemorations).toEqual([
{ kind: 'sanctoral', id: 'st-liborius', name: 'St. Liborius, Bishop and Confessor', rank: 'simplex' },
]);
});
it('St. Apollinaris (Semiduplex) is commemorated on his own Sunday rather than transferring, so the Vigil of St. James the next day is unaffected', () => {
// Corrects an earlier, unverified "transfer+collision" assumption —
// live-verified (Divino Afflatu 1954): a Semiduplex saint landing on
// an ordinary Sunday is commemorated right there, not pushed forward
// (see calendar/commemorations.ts's `ordinary-sunday` case). 2028's
// Jul 23 is a Sunday.
const sunday = resolveDay('2028-07-23');
expect(sunday.winner).toEqual({ kind: 'temporal', id: 'post-pentecost-07' });
expect(sunday.commemorations).toEqual([
{ kind: 'sanctoral', id: 'st-apollinaris', name: 'St. Apollinaris, Bishop and Martyr', rank: 'semiduplex' },
{ kind: 'sanctoral', id: 'st-liborius', name: 'St. Liborius, Bishop and Confessor', rank: 'simplex' },
]);
// The Vigil of St. James wins its own day outright (Vigil outranks
// Simplex), with St. Christina commemorated -- no incoming transfer
// to contend with any more.
const day = resolveDay('2028-07-24');
expect(day.winner).toEqual({ kind: 'sanctoral', id: 'vigil-of-st-james', name: 'Vigil of St. James the Greater', rank: 'vigil' });
expect(day.commemorations).toEqual([
{ kind: 'sanctoral', id: 'st-christina', name: 'St. Christina, Virgin and Martyr', rank: 'simplex' },
]);
});
it('pure octave-continuation days with no named saint at all are excluded entirely', () => {
// 07-01 through 07-08 mostly turned out to have real independent
// content after all (see vu-sanctoral-sweep-progress memory) --
// Most Precious Blood, the Visitation, St. Leo II, St. Anthony Mary
// Zaccaria, the Octave Day of Ss. Peter and Paul itself, Ss. Cyril
// and Methodius, and St. Elizabeth of Portugal are all now mapped.
// 07-04 and 07-09, within those same two octaves, genuinely have no
// independent content in the reference engine and remain excluded.
const day = resolveDay('2028-07-04');
expect(day.winner.kind).toBe('temporal');
expect(day.commemorations).toEqual([]);
});
});