49bd7f7858
Deploy / deploy (push) Successful in 46s
Adds src/scripture/ (types.ts, index.ts), a verse-addressable store mirroring
psalter/index.ts's own pattern exactly -- getScriptureVerses(book, chapter,
range) -- for non-Psalm scripture (Wisdom, Canticles, Ezekiel, Acts, Joel,
etc.). Kept as its own module, not folded into the Psalter, per 2026-08
discussion ("the psalms kind of work differently even if the logic is the
same, they do need their own store").
Octave readings can now declare `passages: [{ book, chapter, verses }]`
instead of embedding text -- each entry becomes its own paragraph, letting a
reading built from several verse ranges keep its original paragraph breaks.
getOctaveReading resolves either shape (embedded text or passages) into the
same OctaveReadingText callers already expect, so nothing downstream needs
to know which was used. Scope, per discussion: only readings that are
Scripture start to finish get this treatment -- prose that merely quotes a
verse or two (most of the patristic sermons pulled so far) keeps its
quotations embedded inline, as before.
Migrates the 9 already-committed octave readings that are pure Scripture
(Wisdom 4:7-20, Canticles 1 and 8, seven different Ezekiel excerpts across
All Saints' octave -- one of which, day 7, genuinely spans two chapters --
and Acts 19/Joel 2 for Pentecost's octave) to the new passages notation,
verified to resolve to character-identical text as before.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
47 lines
2.2 KiB
TypeScript
47 lines
2.2 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import { getOctaveReading } from '../../src/propers';
|
|
|
|
describe('getOctaveReading', () => {
|
|
it('resolves a real reading for a day that has one, collapsed into one continuous text', () => {
|
|
const reading = getOctaveReading('st-lawrence', 2);
|
|
expect(reading?.source).toBe('Sermo sancti Augustíni Epíscopi.');
|
|
expect(reading?.text.la).toContain('Beatissimi Laurentii Martyris');
|
|
expect(reading?.text.en).toContain('most blessed Martyr, Lawrence');
|
|
expect(reading?.status.la).toBe('verified');
|
|
expect(reading?.status.en).toBe('verified');
|
|
expect(reading?.responsory?.la).toContain('Levíta Lauréntius');
|
|
});
|
|
|
|
it('is undefined, not a placeholder, for a day with no reading authored', () => {
|
|
expect(getOctaveReading('st-lawrence', 6)).toBeUndefined(); // Assumption's own day
|
|
expect(getOctaveReading('st-lawrence', 1)).toBeUndefined(); // the feast's own day, not an octave reading
|
|
expect(getOctaveReading('st-lawrence', 99)).toBeUndefined();
|
|
});
|
|
|
|
it('resolves the fuller reading for the octave\'s own concluding day distinctly from ordinary days', () => {
|
|
const reading = getOctaveReading('st-lawrence', 8);
|
|
expect(reading?.text.la).toContain('Ecclesiástici');
|
|
});
|
|
|
|
it('marks a reading with no sourced English translation as honestly missing, not duplicating the Latin', () => {
|
|
const reading = getOctaveReading('st-lawrence', 3);
|
|
expect(reading?.status.en).toBe('missing');
|
|
expect(reading?.text.en).toBeUndefined();
|
|
});
|
|
|
|
it('resolves a reading declared as scripture passages into continuous text, one paragraph per passage', () => {
|
|
const reading = getOctaveReading('all-saints', 2);
|
|
const paragraphs = reading?.text.la?.split('\n\n') ?? [];
|
|
expect(paragraphs.length).toBe(3);
|
|
expect(paragraphs[0]).toContain('1 Et factum est');
|
|
expect(reading?.text.en).toContain('1 Now it came to pass');
|
|
});
|
|
|
|
it('resolves a scripture passage reading that spans two chapters', () => {
|
|
const reading = getOctaveReading('all-saints', 7);
|
|
const paragraphs = reading?.text.la?.split('\n\n') ?? [];
|
|
expect(paragraphs.length).toBe(3); // Ezek 15:1-5, 15:6-8, 16:1-5
|
|
expect(paragraphs[2]).toContain('notas fac Jerúsalem');
|
|
});
|
|
});
|