Skip to content

Expand test coverage and add cross-platform CI matrix - #3

Merged
alexanderkreidich merged 2 commits into
mainfrom
test/coverage-and-ci-matrix
Apr 23, 2026
Merged

Expand test coverage and add cross-platform CI matrix#3
alexanderkreidich merged 2 commits into
mainfrom
test/coverage-and-ci-matrix

Conversation

@alexanderkreidich

Copy link
Copy Markdown
Contributor

Summary

  • Rewrites `.github/workflows/ci.yml` into two jobs: a Linux `lint` job (fmt + clippy) and a `test` matrix job that runs `cargo build` + `cargo test` on ubuntu-latest, macos-latest, and windows-latest with per-OS `Swatinem/rust-cache`.
  • Adds 23 tests across qcli-bin, qcli-tui, and qcli-platform — including an end-to-end CLI workflow test that exercises add/list/copy/pop/pin/unpin against a shared queue file.
  • No production code changed: all additions are tests, CI config, and a Mutex-guarded env-var setup that eliminates a latent parallel-test race in `paths.rs`.

What's new

  • End-to-end workflow test (`crates/qcli-bin/tests/cli_workflow.rs`) — single integration test running the full user journey across every subcommand.
  • Pin/unpin error paths (`crates/qcli-bin/tests/cli_pin.rs`) — `unpin_unknown_id_fails`, `pin_short_id_rejected`, `pin_already_pinned_is_idempotent`.
  • TUI rendering (`crates/qcli-tui/src/render.rs`) — 5 tests using `ratatui::backend::TestBackend` for composer placeholder, queue rows, composer text, status-replaces-hints, and single-line preview.
  • TUI input routing (`crates/qcli-tui/src/runtime.rs`) — 9 tests covering every `map_key` branch (pane-scoped `q`, ctrl-c/ctrl-s, tab/esc/enter, arrows, j/k, printable chars, unmapped keys).
  • qcli-platform (`paths.rs`, `clipboard.rs`) — new tests for `config_path`, `images_dir`, nested-dir creation, and `FakeClipboard` overwrite/default; existing paths tests now take a module-local `Mutex` before mutating `QCLI_APP_DIR` so parallel test threads can't clobber each other's state.

What's not in this PR

Three test files had prior uncommitted content from another agent (`cli_copy.rs`, `cli_pop.rs`, `cli_help.rs`). To avoid stepping on that work, I left those files unstaged — the 7 additional tests I wrote for them stay in the local working tree until they can be reconciled.

Test plan

  • `lint` job passes (fmt + clippy -D warnings)
  • `test (ubuntu-latest)` passes
  • `test (macos-latest)` passes
  • `test (windows-latest)` passes
  • Re-run the matrix after a dependency bump to validate cache keying

sasha added 2 commits April 23, 2026 14:23
Adds unit, integration, and end-to-end tests, and rewrites the CI
workflow so the full test suite runs on ubuntu-latest, macos-latest,
and windows-latest with cargo caching.

- End-to-end CLI workflow test covering add/list/copy/pop/pin/unpin
  against a shared queue file
- Pin/unpin error-path tests (unknown id, short id, idempotent pin)
- TUI render tests using ratatui TestBackend
- TUI map_key unit tests for keyboard routing across panes
- qcli-platform tests for config_path, images_dir, nested app-dir
  creation, and FakeClipboard overwrite/default behavior
- Mutex-guarded env-var access in paths tests to avoid parallel-runner
  flakes
- CI: lint (fmt + clippy) stays single-OS; test job fans out to the
  three release platforms with per-OS cargo caches
The initial test assumed `copy --next` skips pinned prompts, but in
HEAD it returns the first prompt in queue order regardless of pinned
state. On CI — which sees only committed code — this caused
copy --next to return the pinned "sticky note" when the test expected
"first prompt".

Rewrite the scenario so copy --next is only invoked when no pinned
prompt is at the head. The test still exercises every subcommand
(add, list, copy, pop, pin, unpin), pop's skip-pinned behavior, and
the stdin/arg add paths — just without assuming copy also skips.
@alexanderkreidich
alexanderkreidich merged commit 1c7ffcf into main Apr 23, 2026
4 checks passed
@alexanderkreidich
alexanderkreidich deleted the test/coverage-and-ci-matrix branch April 23, 2026 11:38
alexanderkreidich added a commit that referenced this pull request Aug 9, 2026
Expand test coverage and add cross-platform CI matrix
alexanderkreidich added a commit that referenced this pull request Aug 9, 2026
Expand test coverage and add cross-platform CI matrix
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