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>
25 lines
1.3 KiB
JavaScript
25 lines
1.3 KiB
JavaScript
// @vitest-environment node
|
|
import { test, expect } from 'vitest';
|
|
import { checkSignup, generateInviteCode, normalizeInviteCode, isSignupMode } from './signup.js';
|
|
|
|
test('open lets anyone in; the first account is always allowed', () => {
|
|
expect(checkSignup({ mode: 'open', userCount: 5, inviteOk: false }).ok).toBe(true);
|
|
expect(checkSignup({ mode: 'closed', userCount: 0, inviteOk: false }).ok).toBe(true);
|
|
expect(checkSignup({ mode: 'invite', userCount: 0, inviteOk: false }).ok).toBe(true);
|
|
});
|
|
|
|
test('invite-only needs a good code, closed lets nobody in', () => {
|
|
expect(checkSignup({ mode: 'invite', userCount: 2, inviteOk: false })).toMatchObject({ ok: false, status: 403 });
|
|
expect(checkSignup({ mode: 'invite', userCount: 2, inviteOk: true }).ok).toBe(true);
|
|
expect(checkSignup({ mode: 'closed', userCount: 2, inviteOk: true })).toMatchObject({ ok: false, status: 403 });
|
|
});
|
|
|
|
test('invite codes are readable and typed forgivingly', () => {
|
|
const code = generateInviteCode();
|
|
expect(code).toMatch(/^[A-HJKMNP-Z2-9]{4}-[A-HJKMNP-Z2-9]{4}-[A-HJKMNP-Z2-9]{4}$/);
|
|
expect(normalizeInviteCode(` ${code.toLowerCase().replace(/-/g, ' ')} `)).toBe(code);
|
|
expect(normalizeInviteCode('abcd2345jkmn')).toBe('ABCD-2345-JKMN');
|
|
expect(isSignupMode('invite')).toBe(true);
|
|
expect(isSignupMode('nope')).toBe(false);
|
|
});
|