Build and Push Docker Image / build-and-push (push) Failing after 20s
BSB and NET are indexed in the browser; ESV, NLT, CSB and NASB are searched through a server proxy (keys stay server-side). Results page in 25 at a time and jump to the verse. Also fixes a stray trailing comma in CSB chapter text. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
24 lines
1.2 KiB
JavaScript
24 lines
1.2 KiB
JavaScript
import { test, expect } from 'vitest';
|
||
import { parseChapterText, parseEsvReference } from './bibleApi.js';
|
||
|
||
test('parseChapterText splits inline verse markers and cleans provider artifacts', () => {
|
||
const text = ' [1] The Lord is my shepherd;\n I have what I need.\n [2] He lets me lie down #— in pastures, ,\n';
|
||
expect(parseChapterText(text)).toEqual([
|
||
{ number: 1, text: 'The Lord is my shepherd; I have what I need.' },
|
||
{ number: 2, text: 'He lets me lie down — in pastures,' },
|
||
]);
|
||
});
|
||
|
||
test('parseChapterText ignores headings before the first verse', () => {
|
||
expect(parseChapterText('Psalm 23\n\nA Psalm of David.\n\n[1] The LORD is my shepherd;')).toEqual([
|
||
{ number: 1, text: 'The LORD is my shepherd;' },
|
||
]);
|
||
});
|
||
|
||
test('parseEsvReference maps ESV book names back to abbreviations', () => {
|
||
expect(parseEsvReference('Psalm 23:1')).toEqual({ bookAbbrev: 'PSA', chapter: 23, verse: 1 });
|
||
expect(parseEsvReference('1 John 3:16-18')).toEqual({ bookAbbrev: '1JN', chapter: 3, verse: 16 });
|
||
expect(parseEsvReference('Song of Solomon 2:4')).toEqual({ bookAbbrev: 'SNG', chapter: 2, verse: 4 });
|
||
expect(parseEsvReference('Not a book 1:1')).toBeNull();
|
||
});
|