Files
vu/tests/hours/prime.test.ts
T
will a5dc6502d7
Deploy / deploy (push) Failing after 1m8s
Milestone 0/1: shell, calendar/psalter/hours scaffold, Prime
Client-side-first PWA (Vite/TS, no backend) per the approved plan: day-
navigable shell listing all 8 hours, Prime fully resolves via the
calendar -> psalter -> ordo pipeline, the other 7 hours are registered
but flagged not-implemented. Sanctoral/temporal calendar data uses a
day -> id indirection layer (saints, easter-offsets, fixed-date-calendar)
so reassigning a feast to a different day is a data edit, not a code
change. Docker (Caddy-serving-static) + Gitea CI workflow scaffolded to
match the eec/drip/bookshop operational pattern.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-09 15:20:06 -04:00

42 lines
1.6 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { resolveOrdo } from '../../src/hours';
describe('resolveOrdo("prime", ...)', () => {
it('is implemented and resolves a psalm from the weekday-variable slot', () => {
const ordo = resolveOrdo('prime', '2026-08-09');
expect(ordo.notImplemented).toBeUndefined();
expect(ordo.hourId).toBe('prime');
const psalmParts = ordo.parts.filter((p) => p.kind === 'psalm');
expect(psalmParts.length).toBeGreaterThan(0);
expect(psalmParts[0]).toMatchObject({ kind: 'psalm', psalmNumber: 1 });
});
it('resolves fixed parts (hymn, chapter, prayer) as pending until propers data exists', () => {
const ordo = resolveOrdo('prime', '2026-08-09');
const hymn = ordo.parts.find((p) => p.kind === 'hymn');
expect(hymn).toBeDefined();
if (hymn && hymn.kind === 'hymn') {
expect(hymn.text.status.en).toBe('missing');
}
});
it('surfaces verified/draft/missing status per language, per verse', () => {
const ordo = resolveOrdo('prime', '2026-08-09');
const psalm = ordo.parts.find((p) => p.kind === 'psalm');
expect(psalm && psalm.kind === 'psalm' ? psalm.verses.length : 0).toBe(3);
if (psalm && psalm.kind === 'psalm') {
expect(psalm.verses[0]?.status.en).toBe('draft');
expect(psalm.verses[2]?.status.en).toBe('missing');
}
});
});
describe('resolveOrdo for not-yet-built hours', () => {
it('flags compline as not implemented rather than throwing', () => {
const ordo = resolveOrdo('compline', '2026-08-09');
expect(ordo.notImplemented).toBe(true);
expect(ordo.parts).toEqual([]);
});
});