Skip to content

Testing: cover wallet rejection and network error paths - #836

Open
nasalehj wants to merge 1 commit into
UnityChainxx:mainfrom
nasalehj:test/762-wallet-network-error-paths
Open

nasalehj wants to merge 1 commit into
UnityChainxx:mainfrom
nasalehj:test/762-wallet-network-error-paths

Conversation

@nasalehj

Copy link
Copy Markdown

Summary

Resolves #762. Adds explicit coverage for user-rejected transactions and RPC failures, and fixes the UI so those failures are not rendered as wrong answers.

Behaviour fix

  • New frontend/lib/wallet-errors.js classifies Freighter rejections (code 4001 or reject/cancel messages) and transport/RPC failures (fetch/network/timeout/5xx, including a transaction that never finalises) into user-facing messages. The existing "unsupported network" guidance is preserved.
  • usePuzzleContract now routes submit and hint failures through the error state instead of the answer feedback state, so a rejected signature shows an error alert rather than an "Incorrect" toast. Both spinners still clear in finally.

Tests (frontend/tests/wallet-error-paths.e2e.test.jsx, part of npm test)

  • rejected signature → rejection message, no "Incorrect" toast, submit re-enabled, no "Verifying on-chain…"
  • failed RPC account lookup → network error, submit re-enabled
  • RPC rejects the submitted transaction → network error, submit re-enabled
  • hint RPC failure → hint spinner stops and the local fallback hint is shown
  • rejected wallet connection prompt → "Wallet connection was rejected." with an interactive Connect CTA

The component tests drive the real hook and component end to end with a hermetic Freighter/RPC double.

Verification

cd frontend && npx vitest run tests/wallet-error-paths.e2e.test.jsx
# Tests  5 passed (5)

Full frontend suite: 23 failing tests before and after this change (pre-existing environment issues in other spec files), with the 5 new tests added to the passing set — no regressions.

Closes #762

Classify Freighter rejections and Soroban RPC/network failures into
user-facing messages, and stop reporting them as wrong answers: submit
errors now surface through the error alert instead of an "Incorrect"
feedback toast, and the submit/hint spinners always clear.

Add end-to-end component tests that drive the real hook and component
through rejected signatures, failed account lookups, rejected
transactions, hint failures, and rejected connection prompts, asserting
the error text and that the controls return to an interactive state.

Closes UnityChainxx#762

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@nasalehj Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Testing: Test wallet rejection and network error paths

1 participant