Skip to content

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:

powershell
npm test

This 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:

powershell
npx vitest

To run one file:

powershell
npx vitest run src/lib/bible.test.ts

The 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.

FileCovers
src/lib/bible.test.tsBook matching and abbreviations, reference parsing, ranges, comma verse lists, finding references in prose
src/lib/spokenRefs.test.tsReferences 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.tsDragging scripture into the schedule; listing a sermon's references
src/lib/songtext.test.tsSong text import, Order, round trips, songs from DOCX
src/lib/parsers/winners.test.tsReference runs, dates in headings and points in sermon documents
src/lib/ltpack.test.tsThe bundled lower-third packs, the .altarlt format, pack helpers
src/lib/displays.test.tsThe display arrangement map
src/render/layout.test.tsBreaker logos: image, video, missing file
src/render/layoutLowerThird.test.tsLower-third text: blank lines, the empty sub line, shrinking long text before the design grows
src/render/ltMotion.test.tsLower-third text effects and timing, each design's own build
src/render/sungLine.test.tsWhich line of a slide the sung-line colour falls on
src/state/appearance.test.tsInterface font and size preferences
src/state/speech.test.tsThe Heard list: each passage once, newest first, kept across a restart
autopilot/src/follow/follower.test.tsAutopilot'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.tsReading a recording and scoring a replay

Rust ​

The backend ​

powershell
cd src-tauri
cargo test

The 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:

ModuleCovers
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:

FolderTestsCovers
crates/autopilot-link14The Link's message shapes, keys, pairing with the six-digit code, the encrypted channel
crates/altar-speech20WAV reading, the silence warning, model archives, the speech-model choice for the computer, lyric spotting, the streaming model's word pieces
autopilot/src-tauri2Typed 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:

bash
cargo test --lib records_every_input -- --ignored --nocapture

Building 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.

Altar Studio by Milton Black. Free and open source.