Repository navigation
test: integration tests against fixture audio - #16
Merged
Merged
Conversation
…ture Closes #7. - Bundle whisper.cpp's `samples/jfk.wav` (~344 KB, public-domain JFK inaugural excerpt) under `crates/scribe/tests/fixtures/`, with a README documenting license + provenance. - New `tests/transcribe.rs` runs the compiled `scribe transcribe` binary end-to-end into a `TempDir` and asserts: matching `<slug>-YYYYMMDD-HHMMSS` basenames for the `.md`/`.json` pair, full YAML frontmatter key set, ISO-8601 UTC `created`, sidecar field pointing at the JSON filename, non-empty body that doesn't bleed into the closing `---`, JFK-specific "country" substring (proof whisper actually ran), and valid whisper-cli JSON sidecar shape (top-level `transcription` array with `text` + `offsets.{from,to}`). - The integration test self-skips with a clear `eprintln!` reason when ffmpeg / ffprobe / whisper-cli / model is missing, so `cargo test --all` stays green on CI runners without the AI toolchain. Verified locally in both modes. - Gap-filler unit tests in `output.rs` (long stems, all-punctuation, unicode + emoji, dotted version stems, source paths with spaces, titles with colons, ISO-8601 second-precision pin, blank-line closing convention) and `config.rs` (whitespace-only `--model` flag falls through to env precedence; `--keep-temp` plumb-through). Pipeline source (pipeline/ffmpeg/whisper/output/config) is unchanged except for new tests inside the existing `#[cfg(test)] mod tests` blocks; no `pub`-ing of helpers was required because integration tests live outside the binary crate and reimplement small lookup helpers locally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7. Final issue in the v0.1 MVP.
Summary
End-to-end integration test for
scribe transcribeplus targeted unit-test gap-fillers. Pipeline source from PR #15 is unchanged.crates/scribe/tests/fixtures/jfk.wav(~344 KB) andtests/fixtures/README.mddocument license + provenance.crates/scribe/tests/transcribe.rs— full pipeline run against JFK fixture intoTempDir, asserts dual-output naming, frontmatter keys, ISO-8601created, JSON sidecar shape, and JFK-specific "country" substring (proves whisper actually ran).eprintln!+ early return) when ffmpeg / ffprobe / whisper-cli / model is missing — keepscargo test --allgreen on dependency-less CI runners.output.rs(slug edge cases: long, all-punctuation, unicode + emoji, dotted version stems; frontmatter edge cases: paths with spaces, titles with colons, ISO-8601 second-precision pin, closing-blank-line convention) andconfig.rs(whitespace-only--modelfalls through to env;--keep-temppassthrough).Fixture license attribution
jfk.wavis the canonical short-audio test sample bundled by whisper.cpp. Audio content is an excerpt of JFK's 1961 inaugural address — a U.S. federal government work, public domain in the U.S. under 17 U.S.C. § 105. Surrounding whisper.cpp project license is MIT (Copyright © 2023-2026 The ggml authors). Redistribution alongside Scribe (MIT-or-Apache-2.0) is unencumbered. Seecrates/scribe/tests/fixtures/README.mdfor the full attribution.Test counts
tests/cli.rstests/transcribe.rsSample output — run mode (deps available)
Sample output — skip mode (no ffmpeg/whisper/model on PATH)
Cargo treats the early-return as a pass — exactly what CI needs.
Pipeline source unchanged
No changes to
pipeline.rs,ffmpeg.rs,whisper.rs,output.rs(only new#[cfg(test)]items inside the existingmod testsblock), orconfig.rs(same — additions only insidemod tests). The only non-test change isCargo.tomladdingserde_jsonanddirsasdev-dependenciesfor the integration test. No helpers werepub'd — integration tests live outside the binary crate and locally re-implement small lookup helpers (which_on_path,is_executable_file, env-resolvers).Test plan
cargo fmt --allcleancargo clippy --all-targets --all-features -- -D warningscleancargo test --allgreen on host with deps (51 unit + 3 cli + 6 transcribe = 60 tests pass)PATH=/nonexistentand missing env varsOut of scope (per spec)
🤖 Generated with Claude Code