Skip to content

[Repo Assist] test: add coverage for handle_normal_mode key bindings#156

Draft
github-actions[bot] wants to merge 1 commit intomainfrom
repo-assist/test-normal-mode-keybindings-2026-04-26-2881799051fc162d
Draft

[Repo Assist] test: add coverage for handle_normal_mode key bindings#156
github-actions[bot] wants to merge 1 commit intomainfrom
repo-assist/test-normal-mode-keybindings-2026-04-26-2881799051fc162d

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

🤖 This PR was created by Repo Assist, an automated AI assistant.

What

Adds 28 new tests to src/handler.rs covering handle_normal_mode key bindings that had no test coverage.

Why

handle_normal_mode is the central keyboard dispatcher — every normal-mode keystroke routes through it. Most of its branches (quit, help, focus, sort, install, uninstall, upgrade, pin, source filter, view switching, multi-select) were completely untested, meaning regressions could slip through silently.

Covered key paths

Keys What is tested
q / Esc should_quit flag is set
? toggles show_help overlay on and off
Tab / BackTab focus zone cycles between list and detail
S sort cycles from None to Name ↑
p (Search mode) shows informational status, no confirm
p (truncated ID) shows "truncated" status, no confirm
p (unpinned pkg) creates Pin confirm dialog
p (pinned pkg) creates Unpin confirm dialog
P (Search mode) shows informational status
P (Installed mode) cycles pin_filter All → PinnedOnly
i (truncated) shows "truncated" status, no confirm
i (valid pkg) creates Install confirm dialog
x (truncated) shows "truncated" status, no confirm
x (valid pkg) creates Uninstall confirm dialog
u (truncated) shows "truncated" status, no confirm
u (valid pkg) creates Upgrade confirm dialog
I (truncated) shows status, stays in Normal mode
I (available version) prefills version_input from available_version
I (no available version) falls back to version
a selects all packages in Upgrades view
a (all selected) deselects all
f cycles source filter All → Winget
r sets loading = true, status = "Refreshing..."
Right cycles view forward (Search → Installed)
Left cycles view backward (Installed → Search)
Space toggles package selection; second press deselects

Test Status

cargo check --all-targets  → clean
cargo fmt -- --check       → clean
cargo clippy -- -D warnings → clean
cargo test                 → 260 passed (was 232) — 28 new tests

No production code changed.

Generated by Repo Assist · ● 4M ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@cbb46ab386962aa371045839fc9998ee4e97ca64

28 new tests covering previously untested key paths in handle_normal_mode:

- q / Esc  → should_quit
- ?        → toggles show_help overlay
- Tab / BackTab → focus zone toggle
- S        → cycles sort field (None → Name↑)
- p (Search mode) → informational status
- p (truncated ID) → status, no confirm
- p (unpinned pkg) → Pin confirm dialog
- p (pinned pkg)   → Unpin confirm dialog
- P (Search mode)  → informational status
- P (Installed mode) → cycles pin filter
- i (truncated) → status, no confirm
- i (valid)     → Install confirm dialog
- x (truncated) → status, no confirm
- x (valid)     → Uninstall confirm dialog
- u (truncated) → status, no confirm
- u (valid)     → Upgrade confirm dialog
- I (truncated) → status, stays in Normal mode
- I (available_version present) → prefills VersionInput
- I (no available_version)      → falls back to current version
- a             → select all in Upgrades view
- a (all selected) → deselect all
- f → cycles source filter All → Winget
- r → sets loading=true + "Refreshing..." status
- Right → cycles view forward (Search → Installed)
- Left  → cycles view backward (Installed → Search)
- Space → toggles package selection in Upgrades view

Test count: 232 → 260

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants