test(panel): repair context-client harness and cover submit guards + Enter handling (Closes #555) - #633
Open
BernardOnuh wants to merge 1 commit into
Open
test(panel): repair context-client harness and cover submit guards + Enter handling (Closes #555)#633BernardOnuh wants to merge 1 commit into
BernardOnuh wants to merge 1 commit into
Conversation
…ey coverage (Closes Sorokit#555)
|
@BernardOnuh 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! 🚀 |
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.
Closes #555.
What
TransactionPanel.test.tsxhad 11 pre-existing failures onmain— the test if said "All tests pass with npm test", so this PR both repairs the poisoned harness and adds the missing acceptance-criteria coverage.Harness repair (source of the 11 failures)
clientfrom theuseSorokit()context (const { client } = useSorokit()), but every mock in this file only fedgetClient()— so a plain object literal had noclientkey andsubmitTransactionshort-circuited atif (!address || !client)→ "Wallet not connected", and no modal-paths could ever complete. Added amockUseSorokitValue(overrides)helper (same pattern asTransactionHistory.test.tsx) whoseclientgetter falls back togetClient(), and routed all 7 directuseSorokitmock sites through it.XLM) that the current component never renders when the account is still loading (it shows theLoading assets…empty option). Renamed to reflect the real guard (disabled={state === "loading" || isLoadingAccount}) and asserts the disabled state + placeholder instead.New acceptance-criteria tests (
submit guard (#555))0— shows "Amount must be greater than 0" and stays disabled until0.0000001.userEventas the issue requests): Enter on the focused submit button opens the confirmation modal (defaultpreviewMode), and inpreviewMode={false}it submits directly with the correct{ destination, amount }. jsdom does not implement implicit form submission (Enter inside a text field), so the keyboard path is driven through the focused submit button — the same event a browser's implicit submission produces.Verification
npx vitest run src/components/TransactionPanel.test.tsx→ 37 passed (33 existing + 4 new), vs 11 failed | 22 passed on the untouchedmainbaseline.npx eslint src/components/TransactionPanel.test.tsx→ clean.