Files
vu/tests/calendar/vigil-of-christmas-sunday.test.ts
T
will 7f97934282 Give temporal commemorations at Lauds/Vespers a real Ant+V/R+collect bundle
getDayCollects previously rendered a commemorated Sunday/privileged
feria (calendar/commemorations.ts's ordinary-sunday/privileged-sunday/
privileged-feria-minor branches) as a bare, unlabeled collect -- no
antiphon, no versicle, no indication it was even a commemoration. Only
sanctoral commemorations had gotten the fuller bundle treatment
(2026-08-30 pass). Adds temporalCommemorationPart, reusing the temporal
day's own benedictus/magnificat antiphon and weekday-keyed versicle (the
same content it would use had it won outright), falling back to a
labeled bare collect or honest "missing" block when no antiphon is
authored for that id.

Verified live for Nov 1, 2026 (All Saints on a Sunday): both Lauds and
Vespers now show "Commemoration of The 22nd Sunday after Trinity" with
real antiphon and versicle instead of a silent bare prayer.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LGsATZvfnpQ81HQuoF5JuL
2026-09-05 20:07:05 -04:00

82 lines
4.5 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { resolveDay } from '../../src/calendar';
import { resolveOrdo } from '../../src/hours';
// Advent 4's own Sunday lands on Dec 24 (its latest possible date) roughly
// every few years -- 2023 and 2028 are the two nearest examples. Per direct
// instruction (2026-08): the Vigil of Christmas's own identity governs that
// day (matching the reference engine's own rule -- Duplex I classis, never
// displaced even by a privileged Sunday), with Advent 4 itself commemorated
// alongside it -- a deliberate departure from the reference engine's own
// `no commemoratio` for this exact collision, since the Sundays of Advent
// have real standing of their own. See calendar/index.ts's
// applyAdventFourVigilCommemoration and calendar/temporal-id.ts's own
// `vigil-of-christmas` case.
describe('Advent 4 Sunday landing on Dec 24 (the Vigil of Christmas)', () => {
it('2023-12-24: Vigil wins, Advent 4 commemorated', () => {
const day = resolveDay('2023-12-24');
expect(day.weekday).toBe('sunday');
expect(day.winner).toEqual({ kind: 'temporal', id: 'vigil-of-christmas' });
expect(day.commemorations).toEqual([{ kind: 'temporal', id: 'advent-4' }]);
});
it('2028-12-24: same shape, a second real occurrence', () => {
const day = resolveDay('2028-12-24');
expect(day.weekday).toBe('sunday');
expect(day.winner).toEqual({ kind: 'temporal', id: 'vigil-of-christmas' });
expect(day.commemorations).toEqual([{ kind: 'temporal', id: 'advent-4' }]);
});
it("Lauds carries the Vigil's own collect plus Advent 4's commemorated Ant+V/R+collect bundle, and the Vigil's own proper antiphons/Benedictus antiphon", () => {
const lauds = resolveOrdo('lauds', '2023-12-24');
const ownCollect = lauds.parts.find((p) => p.kind === 'prayer');
expect(ownCollect?.kind).toBe('prayer');
if (ownCollect?.kind === 'prayer') {
expect(ownCollect.text.status.la).toBe('verified');
expect(ownCollect.text.status.en).toBe('verified');
expect(ownCollect.text.text.la).toContain('Deus, qui nos redemptiónis nostræ');
}
// Advent 4's own real standing gets the fuller Ant+V/R+collect
// commemoration bundle (see resolve-common.ts's temporalCommemorationPart),
// not a bare collect -- same treatment a sanctoral commemoration gets.
const commemoration = lauds.parts.find((p) => p.kind === 'preces' && p.label?.startsWith('Commemoration of'));
expect(commemoration?.kind).toBe('preces');
if (commemoration?.kind === 'preces') {
expect(commemoration.text.text.la).toContain('Excita, quǽsumus, Dómine');
}
const benedictus = lauds.parts.find((p) => p.kind === 'canticle' && p.canticleId === 'benedictus');
expect(benedictus?.kind).toBe('canticle');
if (benedictus?.kind === 'canticle') {
expect(benedictus.antiphon?.text.la).toContain('Oriétur');
expect(benedictus.antiphon?.status.la).toBe('verified');
}
});
it("Matins Nocturn 3 carries the Vigil's own Gospel (Matt 1:18-21, St. Jerome's homily) and, per this project's generous-commemorations design (the same reason Lauds above shows both collects), Advent 4's own commemorated Gospel (Luke 3:1-6, Pope St. Gregory the Great's homily) too -- still using the Sunday's fixed psalm table throughout", () => {
const matins = resolveOrdo('matins', '2023-12-24');
const gospels = matins.parts.filter((p) => p.kind === 'gospel');
expect(gospels).toHaveLength(2);
const vigilGospel = gospels.find((g) => g.kind === 'gospel' && g.text.citation?.la === 'Matt 1:18-21');
expect(vigilGospel?.kind).toBe('gospel');
if (vigilGospel?.kind === 'gospel') {
expect(vigilGospel.text.status.la).toBe('verified');
expect(vigilGospel.homily?.source).toContain('Jerome');
expect(vigilGospel.homily?.text.status.la).toBe('verified');
}
const advent4Gospel = gospels.find((g) => g.kind === 'gospel' && g.text.citation?.la === 'Luc 3:1-6');
expect(advent4Gospel?.kind).toBe('gospel');
if (advent4Gospel?.kind === 'gospel') {
expect(advent4Gospel.text.status.la).toBe('verified');
expect(advent4Gospel.homily?.source).toContain('Gregory');
expect(advent4Gospel.homily?.text.status.la).toBe('verified');
}
// Nocturns 1-2 keep the ordinary Sunday psalm table (Ps 20-31),
// unaffected by which id won -- hours/matins.ts's threeNocturns/
// sundayPsalmNocturn path is keyed by day.weekday, not day.winner.id.
const psalmCount = matins.parts.filter((p) => p.kind === 'psalm').length;
expect(psalmCount).toBeGreaterThan(0);
});
});