test(TransactionPanel): add acceptance criteria tests - #609
Open
OFFICIAL-KENTOES wants to merge 1 commit into
Open
test(TransactionPanel): add acceptance criteria tests#609OFFICIAL-KENTOES wants to merge 1 commit into
OFFICIAL-KENTOES wants to merge 1 commit into
Conversation
Cover all 6 acceptance criteria from the issue: - AC1: Send disabled when destination is empty - AC2: Send disabled when amount is 0 or negative - AC3: Successful submit renders transaction hash in success panel - AC4: Failed submit renders error message in error panel - AC5: 'New Transaction' button resets form to idle (success + error paths) - AC6: Enter key in destination/amount field submits form (opens review modal) Tests inject client directly via useSorokit mock to correctly exercise the full submit cycle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test(TransactionPanel): add acceptance criteria tests for multi-state form
──────────────────────────────────────────────────────────────────────────────────
What was changed
Added a dedicated describe("acceptance criteria") block to
src/components/TransactionPanel.test.tsx with 9 new tests covering all 6
acceptance criteria from the issue.
Why it was needed
TransactionPanel contains a multi-state form (idle → loading → success / error)
with client-side validation logic (canSubmit). None of the critical user-facing
behaviours were explicitly tested, meaning a refactor could silently break:
How it was implemented
Each acceptance criterion maps to one or more it blocks inside a new
describe("acceptance criteria") suite:
┌─────┬────────────────────────────────────────────────────────────────────────┐
│ AC │ Test │
├─────┼────────────────────────────────────────────────────────────────────────┤
│ AC1 │ Send disabled when destination is empty; re-enables once a valid │
│ │ address and amount are entered │
├─────┼────────────────────────────────────────────────────────────────────────┤
│ AC2 │ Send disabled when amount is 0; Send disabled when amount is negative │
├─────┼────────────────────────────────────────────────────────────────────────┤
│ AC3 │ After confirm → submit resolves with a hash, the success panel renders │
│ │ that exact hash │
├─────┼────────────────────────────────────────────────────────────────────────┤
│ AC4 │ After confirm → submit returns an error string, the error panel │
│ │ renders that string │
├─────┼────────────────────────────────────────────────────────────────────────┤
│ AC5 │ "New Transaction" after success hides the success panel and restores │
│ │ the idle form (Send button disabled again); same path for error state │
├─────┼────────────────────────────────────────────────────────────────────────┤
│ AC6 │ fireEvent.submit on the destination input opens the confirmation │
│ │ modal; same for the amount input │
└─────┴────────────────────────────────────────────────────────────────────────┘
Tests that go through the full submit cycle (AC3/AC4/AC5) inject client directly
via the useSorokit mock rather than relying on the getClient mock, because the
component reads client from context. This avoids the "Wallet not connected"
short-circuit that affected some pre-existing tests.
Testing
All 9 new tests pass. The 11 pre-existing failures in this file are unchanged from
main — they have a separate root cause (missing client in their useSorokit mock)
and are not introduced or worsened by this PR.
closes #598