Files
study-bible-project/src/components/SessionSchedule.test.jsx
T
nmemmertandClaude Sonnet 5.5 54cb1c217d
Build and Push Docker Image / build-and-push (push) Successful in 6m47s
Invite-only sign-up, present mode, series, handouts, templates, dictation, progress, sharing
- 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>
2026-10-06 10:26:43 -04:00

39 lines
1.8 KiB
React

import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { vi, test, expect } from 'vitest';
vi.mock('../utils/icsFile.js', async (orig) => ({ ...(await orig()), downloadIcs: vi.fn() }));
import SessionSchedule, { sessionsOf } from './SessionSchedule.jsx';
import { downloadIcs } from '../utils/icsFile.js';
const chunk = (id, s, e, x = {}) => ({ id, startVerse: s, endVerse: e, ...x });
const project = {
title: 'Romans 8', series: 'Romans', chapters: [{ book: 'Romans', bookAbbrev: 'ROM', chapter: '8', verses: [], chunks: [
chunk('a', 1, 11, { episodeNumber: '4', episodeTitle: 'No condemnation' }), chunk('b', 12, 17),
] }],
};
test('each chunk is a session named for the series, its number and title (or passage)', () => {
const s = sessionsOf(project);
expect(s[0].title).toBe('Romans — Session 4: No condemnation');
expect(s[1].title).toMatch(/^Romans — Session 2: Romans 8:12/);
});
test('the calendar file has one event per session, spaced as asked', async () => {
const user = userEvent.setup();
render(<SessionSchedule project={project} />);
await user.clear(screen.getByLabelText('First session'));
await user.type(screen.getByLabelText('First session'), '2026-10-11');
await user.click(screen.getByRole('button', { name: /download calendar file/i }));
const [text, name] = downloadIcs.mock.calls[0];
expect(name).toBe('romans-8-schedule.ics');
expect(text.match(/BEGIN:VEVENT/g)).toHaveLength(2);
expect(text).toContain('DTSTART;VALUE=DATE:20261011');
expect(text).toContain('DTSTART;VALUE=DATE:20261018'); // a week later
});
test('a study with no chunks shows nothing', () => {
const { container } = render(<SessionSchedule project={{ title: 'x', chapters: [] }} />);
expect(container).toBeEmptyDOMElement();
});