Files
vu/tests/calendar/christ-the-king.test.ts
T
will 427ba6756a
Deploy / deploy (push) Successful in 1m3s
Show rank in the day label for every winner kind, not just sanctoral
Rank display (added in 1fc4bd7) only fired for a plain sanctoral
winner. Every other case -- an active octave day, a named temporal
feast, a season anchor day (Easter, Trinity Sunday, Epiphany), or the
plain ordinal Sunday/feria fallback -- showed no rank at all, which is
what made today's octave day (Aug 18, day 4 of the Assumption's
octave) show no rank. Octave days use the octave's own already-computed
effective rank; anchor days get a fixed Duplex I Class (Ash Wednesday
excepted -- a privileged feria has no duplex-scale rank); the plain
fallback derives a Semiduplex/Feria label from the day's own
temporalCategory, since Sundays/ferias aren't on the duplex scale at
all.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-18 07:41:57 -04:00

40 lines
1.9 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { resolveDay } from '../../src/calendar';
import { getDayLabel } from '../../src/calendar/day-label';
// A 1925 addition, not in the Monastic Tridentinum 1617 base this project
// otherwise targets -- content sourced from "Monastic Divino 1930"
// instead. Always wins the last Sunday of October, commemorating
// whichever Sunday after Pentecost it displaces.
describe('Christ the King (applyChristTheKing)', () => {
it('wins outright on the last Sunday of October, commemorating the Sunday it displaces', () => {
const day = resolveDay('2026-10-25'); // last Sunday of October 2026
expect(day.winner).toEqual({ kind: 'temporal', id: 'christ-the-king' });
expect(day.commemorations).toContainEqual({ kind: 'temporal', id: 'post-pentecost-22' });
expect(getDayLabel(day)).toBe('Christ the King (Duplex I Class)');
});
it('preserves a nested commemoration: a Simplex saint already commemorated under the ordinary Sunday stays commemorated', () => {
// Ss. Chrysanthus and Daria, Simplex, land on 2026-10-25 -- already
// commemorated under the Sunday per the ordinary-sunday rule before
// Christ the King further displaces that Sunday itself.
const day = resolveDay('2026-10-25');
expect(day.commemorations).toContainEqual({
kind: 'sanctoral',
id: 'ss-chrysanthus-and-daria',
name: 'Ss. Chrysanthus and Daria, Martyrs',
rank: 'simplex',
});
});
it('does not apply on any other Sunday in October', () => {
const day = resolveDay('2026-10-18');
expect(day.winner).not.toEqual({ kind: 'temporal', id: 'christ-the-king' });
});
it('correctly finds a different last Sunday of October in a year where Oct 31 itself is a Sunday', () => {
const day = resolveDay('2027-10-31'); // 2027-10-31 is a Sunday
expect(day.winner).toEqual({ kind: 'temporal', id: 'christ-the-king' });
});
});