Build and Push Docker Image / build-and-push (push) Successful in 6m47s
- Admin: sign-up Open / Invite only / Closed with single-use invite links - Present mode for scripts (auto-scroll) and outlines (step through, pace vs planned minutes) - Series: group studies on the dashboard, filter by series, calendar file for a study's sessions - Lesson handout: printable page per session (passage, outline, questions, writing lines) - Save a chunk's notes as your own study template (synced) - Voice dictation for notes and scripts (browser speech recognition) - Reading progress: map of the 66 books and a calendar of days read, synced and merged across devices - Export highlights and bookmarks as Markdown or Word, grouped by named colour - Verse of the day push to the ntfy topic (needs IQBIBLE_API_KEY) - Sharing: co-teacher editing via single-use invite links; read-only links can expire and take a passcode Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
24 lines
1.3 KiB
JavaScript
24 lines
1.3 KiB
JavaScript
// @vitest-environment node
|
|
import { test, expect } from 'vitest';
|
|
import { cleanHistory, mergeHistory } from './readerHistory.js';
|
|
|
|
test('only well-formed chapters and days are kept', () => {
|
|
const out = cleanHistory({
|
|
chapters: { 'JHN.3': { n: 2, last: '2026-10-01' }, 'bad': { n: 1 }, 'GEN.1': { n: -5, last: 'yesterday' }, '1JN.2': null },
|
|
days: ['2026-10-02', 'nope', '2026-10-01', '2026-10-01'],
|
|
});
|
|
expect(out.chapters).toEqual({ 'JHN.3': { n: 2, last: '2026-10-01' }, 'GEN.1': { n: 1, last: '' } });
|
|
expect(out.days).toEqual(['2026-10-01', '2026-10-02']);
|
|
expect(cleanHistory(null)).toEqual({ chapters: {}, days: [] });
|
|
});
|
|
|
|
test('merging keeps the larger count, the later date and every day', () => {
|
|
const a = { chapters: { 'JHN.3': { n: 2, last: '2026-10-01' }, 'GEN.1': { n: 1, last: '2026-09-01' } }, days: ['2026-10-01'] };
|
|
const b = { chapters: { 'JHN.3': { n: 1, last: '2026-10-05' }, 'ROM.8': { n: 1, last: '2026-10-04' } }, days: ['2026-10-04', '2026-10-05'] };
|
|
const m = mergeHistory(a, b);
|
|
expect(m.chapters['JHN.3']).toEqual({ n: 2, last: '2026-10-05' });
|
|
expect(Object.keys(m.chapters).sort()).toEqual(['GEN.1', 'JHN.3', 'ROM.8']);
|
|
expect(m.days).toEqual(['2026-10-01', '2026-10-04', '2026-10-05']);
|
|
expect(mergeHistory(m, m)).toEqual(m); // merging again changes nothing
|
|
});
|