f7af1e7cbf
Deploy / deploy (push) Successful in 1m6s
St. Charles Borromeo (11-04), the Octave Day of All Saints (11-08, own real Cyprian/Augustine Nocturn 2-3 content, collect reused from All Saints via cross-id propers), St. Albert the Great (11-15), St. Gertrude (11-16), St. Felix of Valois (11-20). All Souls' Day (11-02) deliberately skipped -- a Requiem office, not a normal saint's office, a genuine mechanism gap. Several new fixed-date Duplex+ saints displaced existing test fixtures that had assumed particular dates were clean/ferial/ plain-Sunday: prime.test.ts's MONDAY constant, weekday.test.ts's clean-Sunday case, and day-label.test.ts's post-Epiphany-overflow and open-octave-day cases. Fixed by finding genuinely clean alternate dates/years, never by weakening assertions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
54 lines
2.1 KiB
TypeScript
54 lines
2.1 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { weekdayOf } from '../../src/calendar/weekday';
|
|
import { resolveDay } from '../../src/calendar';
|
|
|
|
describe('weekdayOf', () => {
|
|
it('resolves a known Sunday', () => {
|
|
// 2026-08-09 is a Sunday.
|
|
expect(weekdayOf('2026-08-09')).toBe('sunday');
|
|
});
|
|
|
|
it('resolves each day of a full week correctly', () => {
|
|
const expected = [
|
|
['2026-08-09', 'sunday'],
|
|
['2026-08-10', 'monday'],
|
|
['2026-08-11', 'tuesday'],
|
|
['2026-08-12', 'wednesday'],
|
|
['2026-08-13', 'thursday'],
|
|
['2026-08-14', 'friday'],
|
|
['2026-08-15', 'saturday'],
|
|
] as const;
|
|
for (const [date, weekday] of expected) {
|
|
expect(weekdayOf(date)).toBe(weekday);
|
|
}
|
|
});
|
|
|
|
it('is not affected by the local timezone offset', () => {
|
|
// Regression guard: resolving via `new Date(isoDate)` without pinning to
|
|
// UTC would give different weekdays depending on the host's timezone.
|
|
expect(weekdayOf('2026-01-01')).toBe('thursday');
|
|
});
|
|
});
|
|
|
|
describe('resolveDay', () => {
|
|
it('resolves a plain Sunday with no occurring feast', () => {
|
|
// Not 2026-08-09 (also a Sunday): since the August sanctoral pull, that
|
|
// date does carry a real commemoration (St. Romanus, impeded from
|
|
// winning by the Vigil of St. Lawrence, itself impeded by the Sunday
|
|
// and transferred away — see tests/calendar/transfer.test.ts, and
|
|
// confirmed against the live reference engine, which shows the same
|
|
// commemoration despite the vigil's own absence that day). Also not
|
|
// 2026-10-04 (moved here from there): since the October pull, that
|
|
// date is St. Francis's own day (Duplex), which wins outright even on
|
|
// an ordinary Sunday.
|
|
// Not 2026-11-15 either (moved here from there): since the November
|
|
// pull, that date is St. Albert the Great's own day (Duplex), same
|
|
// reason. 2026-09-06 (post-pentecost-15) is genuinely clean.
|
|
const day = resolveDay('2026-09-06');
|
|
expect(day.date).toBe('2026-09-06');
|
|
expect(day.weekday).toBe('sunday');
|
|
expect(day.winner.kind).toBe('temporal');
|
|
expect(day.commemorations).toEqual([]);
|
|
});
|
|
});
|