db9c844caf
Adds transferredFrom to both DayWinner's sanctoral variant and Commemoration's sanctoral variant, set in calendar/index.ts's applyIncomingTransfer whenever a transferred-in candidate actually lands (wins outright) or ends up merely commemorated (lost a collision, or fell below the landing day's own threshold) — previously this signal was discarded after resolveDay used it once to decide the winner, so nothing downstream could tell a transferred feast apart from a native one. Also adds transferredAway to LiturgicalDay, set from a date's own native occurrence when its candidate couldn't be kept there at all, so a UI can note "this office moved elsewhere" without asserting a specific landing date (which a later, unmodeled multi-hop chain — e.g. into Holy Week — could get wrong). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013g7AsSvMD9oazR17f3BxLz
61 lines
2.8 KiB
TypeScript
61 lines
2.8 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, and clear of
|
|
// the movable Holy Week/Easter Octave that usually overshadows several of
|
|
// them) — see data/calendar/saints/*.yml for per-saint source detail.
|
|
describe('April sanctoral pull (first pass)', () => {
|
|
it('St. Mark wins outright with a real proper collect on an ordinary date', () => {
|
|
const day = resolveDay('2042-04-25');
|
|
expect(day.winner).toEqual({
|
|
kind: 'sanctoral',
|
|
id: 'st-mark',
|
|
name: 'St. Mark, Evangelist',
|
|
nameLa: 'Sanctus Marcus, Evangelista',
|
|
rank: 'duplex-2-classis',
|
|
});
|
|
expect(getDayCollect(day).status.en).toBe('verified');
|
|
});
|
|
|
|
it('St. Mark is only ever commemorated, never wins, within the Easter Octave', () => {
|
|
const day = resolveDay('2030-04-25');
|
|
expect(day.winner.kind).toBe('temporal');
|
|
expect(day.commemorations).toEqual([
|
|
{ kind: 'sanctoral', id: 'st-mark', name: 'St. Mark, Evangelist', nameLa: 'Sanctus Marcus, Evangelista', rank: 'duplex-2-classis' },
|
|
]);
|
|
});
|
|
|
|
it('St. Robert beats St. Catherine of Siena on their shared monastic-calendar date', () => {
|
|
const day = resolveDay('2043-04-29');
|
|
expect(day.winner).toEqual({ kind: 'sanctoral', id: 'st-robert', name: 'St. Robert, Abbot', nameLa: 'Sanctus Robertus, Abbas', rank: 'duplex' });
|
|
expect(day.commemorations).toEqual([
|
|
{ kind: 'sanctoral', id: 'st-catherine-of-siena', name: 'St. Catherine of Siena, Virgin', nameLa: 'Sancta Catharina Senensis, Virgo', rank: 'simplex' },
|
|
]);
|
|
});
|
|
|
|
it('a privileged Eastertide Sunday bumps even St. Robert (plain Duplex, not Duplex majus) to transfer forward', () => {
|
|
// 2029: Apr 29 is a privileged Sunday in Eastertide, so Robert can't
|
|
// win or be commemorated there — he transfers to Monday and wins the
|
|
// collision against St. Peter Martyr instead.
|
|
const sunday = resolveDay('2029-04-29');
|
|
expect(sunday.winner).toEqual({ kind: 'temporal', id: 'easter-5' });
|
|
expect(sunday.commemorations).toEqual([
|
|
{ kind: 'sanctoral', id: 'st-catherine-of-siena', name: 'St. Catherine of Siena, Virgin', nameLa: 'Sancta Catharina Senensis, Virgo', rank: 'simplex' },
|
|
]);
|
|
|
|
const monday = resolveDay('2029-04-30');
|
|
expect(monday.winner).toEqual({
|
|
kind: 'sanctoral',
|
|
id: 'st-robert',
|
|
name: 'St. Robert, Abbot',
|
|
nameLa: 'Sanctus Robertus, Abbas',
|
|
rank: 'duplex',
|
|
transferredFrom: '2029-04-29',
|
|
});
|
|
expect(monday.commemorations).toEqual([
|
|
{ kind: 'sanctoral', id: 'st-peter-martyr', name: 'St. Peter Martyr, Martyr', nameLa: 'Sanctus Petrus Martyr, Martyr', rank: 'semiduplex' },
|
|
]);
|
|
});
|
|
});
|