Skip to content

test(state): table tests for pure action handlers + join_flow decisions (R26)#105

Merged
stormer78 merged 1 commit into
mainfrom
r26-action-handler-tests
Jun 12, 2026
Merged

test(state): table tests for pure action handlers + join_flow decisions (R26)#105
stormer78 merged 1 commit into
mainfrom
r26-action-handler-tests

Conversation

@stormer78

Copy link
Copy Markdown
Contributor

What

A first slice of R26 (tests are ongoing, landed in slices). Adds direct tests for the pure mode-transition handlers that previously had none, and peels join_flow.rs's pure decisions into testable free functions.

Tests added (17)

Following the setup_flow/navigation.rs table-test pattern:

  • settings_actions (7) — handle_start_edit index→mode map (incl. View fallback + input seeding), handle_field_update, handle_change_protection + sub-field handlers, export/import form field + tab-switch, handle_wipe_start/handle_wipe_input, handle_select.
  • credential_actions (4) — tab cycle + index reset, open-detail/back, start-new-request, reason-update (incl. no-op outside NewRequest).
  • relationship_actions (4) — start-new-request + cancel/back, open-detail, input-update field routing, toggle-R-DID.
  • join_flow (3) — the extracted free functions below.

join_flow.rs extraction (mechanical, behavior-neutral)

No client trait or mock introduced. Three pure decisions peeled out of the existing call sites, which now delegate to them:

  • validate_join_input — the trim + empty-reject from the submit arm.
  • is_duplicate_membership — wraps the step-1 idempotency check.
  • build_pending_record — wraps the step-9 CommunityRecord::new_pending.

Scope

main/mod.rs is untouched (its key-handler tests are a later slice). Handlers that do I/O (token/keyring/filesystem, network) are left out of the pure table tests; the network ones are already covered by existing *Outcome::apply tests.

Gate

Rebased onto current main; cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, cargo test -p openvtc (113 passed) — all green.

🤖 Generated with Claude Code

…ns (R26)

The mode-transition handlers in `settings_actions.rs`,
`credential_actions.rs`, and `relationship_actions.rs` are pure functions of
`&mut State` but had no direct tests. Add table tests (following the
`setup_flow/navigation.rs` pattern) covering each handler's mode
transitions — 17 tests in total across the three modules.

For `join_flow.rs`, peel three pure decisions out of the existing call sites
into free functions (no client trait / mock introduced) and test them:
`validate_join_input`, `is_duplicate_membership`, `build_pending_record`.
The call sites now delegate to these — behavior is unchanged.

Handlers that do I/O (token/keyring/filesystem, network) are intentionally
left out of the pure table tests; the network ones are already covered by
the existing `*Outcome::apply` tests. `main/mod.rs` is untouched (its
key-handler tests are a later slice).

Gate: cargo fmt --all, clippy --workspace --all-targets -D warnings, cargo
test -p openvtc (113 passed) — all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Glenn Gore <glenn.g@affinidi.com>
@stormer78 stormer78 requested a review from a team as a code owner June 12, 2026 02:25
@stormer78 stormer78 merged commit f12a3da into main Jun 12, 2026
11 of 13 checks passed
@stormer78 stormer78 deleted the r26-action-handler-tests branch June 12, 2026 03:32
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