Files
study-bible-project/src/utils/presentSync.test.js
T
nmemmertandClaude Sonnet 5.5 7ba5ed41b5 Present mode: private speaker notes, audience window, presenter view
- Speaker notes are hidden on the presenting screen by default (N / "Show notes"
  turns them on for one-screen use), so a mirrored display never shows them.
- "Audience window" opens a second window for a projector (?audience=1, no sign-in)
  that shows only the point, its passage and quoted verse. Notes, minutes, the
  script and the timer are never sent to it.
- With it connected this screen becomes a presenter view: what the audience sees,
  your notes, the next point, plus Blank audience (B) and audience text size.
- Script mode sends the audience only the title.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-14 13:23:16 -04:00

29 lines
1.7 KiB
JavaScript

import { test, expect } from 'vitest';
import { audienceState, audienceUrl, isAudienceWindow, publicStep } from './presentSync.js';
const step = { id: 'a', label: 'I.', depth: 0, text: 'Welcome', ref: 'Rom 1:16', note: 'SECRET speaker note', minutes: 7, plannedEnd: 7, kind: 'quote',
scripture: { text: 'For I am not ashamed', ref: 'Romans 1:16', translation: 'BSB' }, attachments: [{ id: 'x', type: 'word', label: 'pistis', detail: 'PRIVATE detail' }] };
test('what the audience gets of a point never includes the private note, minutes or details', () => {
const pub = publicStep(step);
expect(pub).toEqual({ label: 'I.', kind: 'quote', text: 'Welcome', ref: 'Rom 1:16', scripture: { text: 'For I am not ashamed', ref: 'Romans 1:16' }, attachments: [{ type: 'word', label: 'pistis' }] });
const message = JSON.stringify(audienceState({ title: 'Romans', mode: 'outline', step, index: 0, total: 3 }));
expect(message).not.toMatch(/SECRET|PRIVATE|minutes|plannedEnd/);
expect(message).toContain('Welcome');
});
test('in script mode the audience gets the title only, and blank blacks the screen out', () => {
const state = audienceState({ title: 'Romans 8', subtitle: 'Session 1', mode: 'script', step, blank: true });
expect(state.step).toBeNull();
expect(state.blank).toBe(true);
expect(JSON.stringify(state)).not.toMatch(/SECRET|Welcome/);
expect(publicStep(null)).toBeNull();
});
test('the audience window is recognised by its address', () => {
expect(audienceUrl({ origin: 'https://study.test', pathname: '/' })).toBe('https://study.test/?audience=1');
expect(isAudienceWindow('?audience=1')).toBe(true);
expect(isAudienceWindow('?share=abc')).toBe(false);
expect(isAudienceWindow('')).toBe(false);
});