Build and Push Docker Image / build-and-push (push) Failing after 19s
- Commentary tab: "More sources" switch with notes for the whole chunk and "Add to notes" quoting - Word study: Lexicons button for words with a Strong's number - New "Study aids" tab (any verse of the chunk; topics add as tags) - Outline points: "Add from IQ Bible" attaches topics, Gospel parallels, manuscript notes and places Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
40 lines
1.9 KiB
JavaScript
40 lines
1.9 KiB
JavaScript
import { test, expect } from 'vitest';
|
|
import { normalizeStrongs, pickIqEntries, describeRecord, listOf, iqUrl } from './iqbible.js';
|
|
|
|
test('Strong\'s numbers are normalised', () => {
|
|
expect(normalizeStrongs('G0026')).toBe('G26');
|
|
expect(normalizeStrongs('h430')).toBe('H430');
|
|
expect(normalizeStrongs('H1647G')).toBe('H1647');
|
|
expect(normalizeStrongs('nope')).toBeNull();
|
|
});
|
|
|
|
test('commentary entries are chosen by range, then by the closest earlier verse', () => {
|
|
const entries = [
|
|
{ chapter: 3, verse: 0, text: 'intro' },
|
|
{ chapter: 3, verse: 1, verse_end: 8, text: 'a' },
|
|
{ chapter: 3, verse: 9, text: 'b' },
|
|
{ chapter: 3, verse: 9, text: 'b2' },
|
|
];
|
|
expect(pickIqEntries(entries, 3, 5).map((e) => e.text)).toEqual(['a']);
|
|
expect(pickIqEntries(entries, 3, 12).map((e) => e.text)).toEqual(['b', 'b2']);
|
|
expect(pickIqEntries(entries, 4, 1)).toEqual([]);
|
|
});
|
|
|
|
test('loosely shaped records are summarised and lists found', () => {
|
|
expect(describeRecord({ name: 'faith', edition: 'iqbible', citation: 'John 3:16' }).title).toBe('faith');
|
|
expect(describeRecord('x').title).toBe('x');
|
|
expect(listOf({ status: 'ok', data: [1, 2] })).toEqual([1, 2]);
|
|
expect(listOf({ topics: [3] })).toEqual([3]);
|
|
expect(iqUrl('bibles/eng_kjv/reading-plan', { days: 30, books: 'MAT,MRK', format: 'ical', skip: '' })).toBe('/api/iq/bibles/eng_kjv/reading-plan?days=30&books=MAT%2CMRK&format=ical');
|
|
});
|
|
|
|
test('a chunk\'s verse range picks every entry starting inside it, plus one covering its start', () => {
|
|
const entries = [
|
|
{ chapter: 3, verse: 1, verse_end: 4, text: 'covers the start' },
|
|
{ chapter: 3, verse: 6, text: 'inside' },
|
|
{ chapter: 3, verse: 12, text: 'after' },
|
|
];
|
|
expect(pickIqEntries(entries, 3, 3, 8).map((e) => e.text)).toEqual(['covers the start', 'inside']);
|
|
expect(pickIqEntries(entries, 3, 9, 11).map((e) => e.text)).toEqual(['inside']); // nothing inside: closest earlier
|
|
});
|