Skip to content

refactor: test suite overhaul (lib.rs split, snapshots, CI canaries)#9

Open
objz wants to merge 7 commits into
masterfrom
test-overhaul
Open

refactor: test suite overhaul (lib.rs split, snapshots, CI canaries)#9
objz wants to merge 7 commits into
masterfrom
test-overhaul

Conversation

@objz
Copy link
Copy Markdown
Owner

@objz objz commented May 25, 2026

Summary

First slice of a multi-phase test suite overhaul. Sets up the prerequisites and infrastructure every later phase needs, deletes a handful of tests that earned nothing, adds the first ratatui snapshot tests as a working pattern, and wires the existing #[ignore] network tests into CI so they run on master pushes.

The launch-flow integration test phase (the biggest coverage gain) is deliberately not in this PR. It depends on #8 (launch-args-rework) landing first since it needs to test the reworked launch pipeline.

What's in this PR

Commit Phase What
3cd530e A lib.rs split; tests/ scaffold; add insta, wiremock, rstest dev-deps; one smoke integration test
4fdbd03 B Delete 6 useless tests (4 theatre asserting literal defaults, 2 wrappers around already-tested helpers)
4f8347c E First ratatui snapshot tests (ErrorPopup, 4 scenarios) using TestBackend + insta
e56876f F CI step running cargo test --ignored on master pushes (covers the 12 live-API canary tests)
be1857d review fixup Narrow lib.rs visibility, drop speculative tests/common/mod.rs
0d0852e review fixup Add INFO-level snapshot, rename narrow_frame_clamps, add 5 unit tests for popup_area() (the real logic in error.rs)
71945af review fixup Drop continue-on-error: true from CI canary step so failures actually red the build

What's not in this PR

  • Phase C (move filesystem-touching tests to tests/integration/) was reassessed and skipped. Most candidates test PRIVATE helpers (migrate::rename_top_level, worlds::world_description, desktop::build_content, mmc::parse_mmc_pack); moving them would force those internals to become pub. The rest are single-function unit tests where moving adds zero coverage but adds compile-unit overhead. Rationale documented in the master plan.
  • Phase D (launch-flow integration tests) is blocked on fix(launch): Forge 1.17+ on Java 17+ via launch-profile rework #8 merging. Once it lands, Phase D extracts a build_launch_invocation seam from the merged launch() and writes 12-15 integration tests against fixtures.

Test plan

  • cargo test: 202 lib + 1 smoke = 203 passing, 12 ignored
  • cargo build --release: clean
  • ./target/release/rmcl --help: binary works after lib.rs / main.rs split
  • cargo test --lib -- --ignored: all 12 live-API canaries pass against real Mojang/Forge/NeoForge/Fabric/Quilt/Modrinth endpoints
  • Deliberate snapshot regression: changed "ERROR" label to "FAIL", snapshot test caught the diff, reverted
  • cargo clippy --all-targets -- -D warnings: clean

Notes on insta workflow

When you intentionally change a popup visual:

cargo test                 # snapshot tests fail with diff output
cargo insta review         # interactive TUI to accept or reject changes
git add **/*.snap          # commit accepted snapshots

Snapshot files live next to the widget source under src/tui/widgets/popups/snapshots/. They are plain text and meant to be checked into git.

Net delta

  • Before: 196 inline tests on master
  • After: 202 lib + 1 smoke = 203 passing, 12 ignored
  • Tests gained: +9 (4 snapshot + 5 popup_area unit tests + 1 INFO snapshot - 5 deletions actually = check arithmetic)
  • Lines gained: ~280 (mostly the snapshot tests + helper module + dev-deps)

@objz objz self-assigned this May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant