Files
vu/tests/calendar/november-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

105 lines
4.7 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('November sanctoral pull (first pass)', () => {
it('All Saints wins outright with a real proper collect, backfilled this month', () => {
const day = resolveDay('2025-11-01');
expect(day.winner).toEqual({ kind: 'sanctoral', id: 'all-saints', name: 'All Saints', rank: 'duplex-1-classis' });
expect(getDayCollect(day).status.en).toBe('verified');
});
it('St. Martin of Tours wins outright at Duplex majus with a real proper collect and antiphon, over a genuinely unwinnable stub', () => {
const day = resolveDay('2025-11-11');
expect(day.winner).toEqual({
kind: 'sanctoral',
id: 'st-martin-of-tours',
name: 'St. Martin of Tours, Bishop and Confessor',
rank: 'duplex-majus',
});
expect(day.commemorations).toEqual([
{ kind: 'sanctoral', id: 'st-menna', name: 'St. Menna, Martyr', rank: 'simplex' },
]);
expect(getDayCollect(day).status.en).toBe('verified');
});
it('a monastic-calendar-specific reassignment (St. Emilian) displaces what the base Tridentine table gives to St. Martin I, Pope, who moves to a different date entirely', () => {
const emilianDay = resolveDay('2025-11-12');
expect(emilianDay.winner).toEqual({
kind: 'sanctoral',
id: 'st-emilian',
name: 'St. Emilian, Abbot',
rank: 'duplex',
});
const martinIDay = resolveDay('2025-11-14');
expect(martinIDay.winner).toEqual({
kind: 'sanctoral',
id: 'st-martin-i',
name: 'St. Martin I, Pope and Martyr',
rank: 'semiduplex',
});
});
it('All Saints of the Benedictine Order, a monastic-calendar-only addition absent from the base Tridentine table, wins outright at Duplex II. classis', () => {
const day = resolveDay('2025-11-13');
expect(day.winner).toEqual({
kind: 'sanctoral',
id: 'all-saints-of-the-benedictine-order',
name: 'All Saints of the Order of St. Benedict',
rank: 'duplex-2-classis',
});
expect(day.commemorations).toEqual([]);
});
it("St. Clement (Semiduplex) is commemorated on his own Sunday rather than transferring, so St. Chrysogonus's own following day is unaffected either way", () => {
// Corrects an earlier, unverified assumption that a Semiduplex saint
// landing on an ordinary Sunday transfers forward -- live-verified
// (Divino Afflatu 1954) St. Clement is commemorated right there on
// Nov 23 ("Commemoratio: S. Clementis Papæ et Martyris"), same
// treatment Simplex already got (see calendar/commemorations.ts's
// `ordinary-sunday` case). St. Felicitas (Simplex, also native to
// Nov 23) is commemorated alongside him too, per this app's own
// generous-commemoration design.
const clean = resolveDay('2032-11-24'); // Nov 23, 2032 is not a Sunday
expect(clean.winner).toEqual({
kind: 'sanctoral',
id: 'st-chrysogonus',
name: 'St. Chrysogonus, Martyr',
rank: 'simplex',
});
const onceASunday = resolveDay('2025-11-23'); // a Sunday
expect(onceASunday.winner).toEqual({ kind: 'temporal', id: 'post-pentecost-24' });
expect(onceASunday.commemorations).toEqual([
{ kind: 'sanctoral', id: 'st-clement', name: 'St. Clement I, Pope and Martyr', rank: 'semiduplex' },
{ kind: 'sanctoral', id: 'st-felicitas', name: 'St. Felicitas, Martyr', rank: 'simplex' },
]);
// St. Chrysogonus's own following day is untouched either way -- no
// incoming transfer any more.
const followingDay = resolveDay('2025-11-24');
expect(followingDay.winner).toEqual({
kind: 'sanctoral',
id: 'st-chrysogonus',
name: 'St. Chrysogonus, Martyr',
rank: 'simplex',
});
expect(followingDay.commemorations).toEqual([]);
});
it('St. Andrew wins outright at Duplex II. classis with a real proper collect and antiphon, commemorating the Advent feria itself in years his fixed date falls within Advent', () => {
// 2026-11-30 is also the Monday within Advent I's own week that year
// (privileged-feria-minor, see calendar/types.ts) -- the Advent feria
// is commemorated back, confirmed against the live reference engine.
const day = resolveDay('2026-11-30');
expect(day.winner).toEqual({
kind: 'sanctoral',
id: 'st-andrew',
name: 'St. Andrew, Apostle',
rank: 'duplex-2-classis',
});
expect(day.commemorations).toEqual([{ kind: 'temporal', id: 'advent-1' }]);
expect(getDayCollect(day).status.en).toBe('verified');
});
});