Run the tests
Altar Studio has two kinds of test: TypeScript tests run with vitest, and Rust unit tests run with cargo. The Rust tests live in four separate crates: the backend (src-tauri), the two shared crates in crates/, and the Autopilot app.
TypeScript
From the app repository root:
npm testThis runs vitest run once over every *.test.ts file, Autopilot's included. Expect 177 tests in 15 files, finishing in a few seconds.
To re-run tests as you edit:
npx vitestTo run one file:
npx vitest run src/lib/bible.test.tsThe tests use vitest's defaults (a Node environment) and pick up the @ path alias from vite.config.ts. They import pure modules and stores, never React components. The listening store's test runs against the mock backend's scripted sermon.
| File | Covers |
|---|---|
src/lib/bible.test.ts | Book matching and abbreviations, reference parsing, ranges, comma verse lists, finding references in prose |
src/lib/spokenRefs.test.ts | References as speech-to-text writes them: number words, numbered books, chapter and verse keywords, ranges, "verse 17" carried over from the last reference |
src/lib/scriptureRefs.test.ts | Dragging scripture into the schedule; listing a sermon's references |
src/lib/songtext.test.ts | Song text import, Order, round trips, songs from DOCX |
src/lib/parsers/winners.test.ts | Reference runs, dates in headings and points in sermon documents |
src/lib/ltpack.test.ts | The bundled lower-third packs, the .altarlt format, pack helpers |
src/lib/displays.test.ts | The display arrangement map |
src/render/layout.test.ts | Breaker logos: image, video, missing file |
src/render/layoutLowerThird.test.ts | Lower-third text: blank lines, the empty sub line, shrinking long text before the design grows |
src/render/ltMotion.test.ts | Lower-third text effects and timing, each design's own build |
src/render/sungLine.test.ts | Which line of a slide the sung-line colour falls on |
src/state/appearance.test.ts | Interface font and size preferences |
src/state/speech.test.ts | The Heard list: each passage once, newest first, kept across a restart |
autopilot/src/follow/follower.test.ts | Autopilot's follower: opening scriptures from The Word, following a reading, going back, unfinished readings, The Word's next slide, songs and hymns, spotted lyric lines, Auto |
autopilot/src/measure/measure.test.ts | Reading a recording and scoring a replay |
Rust
The backend
cd src-tauri
cargo testThe first run compiles the whole backend in debug mode, downloads the speech engine's libraries (see Build installers) and can take several minutes. Expect 45 tests:
| Module | Covers |
|---|---|
coordinator.rs (13) | Autopilot's moves and every rule they're held to, the Word context, reading the slide text for Autopilot |
outputs.rs (12) | Display rectangles on macOS (logical) and Windows (physical), scale factors, window placement, screen-name matching |
autopilot_log.rs (7) | The decision log: suggestions taken, gone elsewhere, expired; moves missed; Autopilot's own moves kept or undone |
autopilot_track.rs (5) | Earning Auto per kind, losing it again, the operator's override |
docparse.rs (3) | DOCX headings, lists, tables, revisions, stanza breaks |
pptx.rs (2) | Paths inside PowerPoint files, text shapes |
autopilot.rs (1) | The field names of Autopilot's requests to the control window |
autopilot_net.rs (1) | The network announcement never uses the computer's own name |
permissions.rs (1) | Which origins get camera access |
Some outputs.rs tests check the current platform, so the macOS branch only runs on a Mac.
The shared crates and Autopilot
Each is its own crate, so run cargo test in its folder:
| Folder | Tests | Covers |
|---|---|---|
crates/autopilot-link | 14 | The Link's message shapes, keys, pairing with the six-digit code, the encrypted channel |
crates/altar-speech | 20 | WAV reading, the silence warning, model archives, the speech-model choice for the computer, lyric spotting, the streaming model's word pieces |
autopilot/src-tauri | 2 | Typed network addresses, recordings |
Several altar-speech tests need a downloaded model and pass without doing anything unless an environment variable points at it, such as SPEECH_TEST_MODEL_DIR (an unpacked model archive), SPEECH_TEST_MODELS with SPEECH_TEST_WAV, or LYRICS_TEST_MODEL_DIR. Each test's comment gives the command. Two tests need real audio hardware and run only on request:
cargo test --lib records_every_input -- --ignored --nocaptureBuilding a shared crate on its own writes to crates/<name>/target/, which git ignores.
Type-check
There's no separate type-check script. npm run build runs tsc with strict settings before bundling, so use it to catch type errors. For Autopilot's interface, run npm run build in autopilot/.
What isn't covered
There are no automated tests for React components, most stores, the mock backend, the database, backups, packages, or the Link server and launching Autopilot. Most of the live coordinator is also untested apart from Autopilot's rules. For changes in those areas, test by hand in the desktop app with npm run tauri dev. The live coordinator page lists the cases worth trying. For Autopilot, the development aids in Run Altar Studio from source run a scripted service end to end.