Repository navigation
Harden swap, governance and balance components with tests - #1001
Merged
k-deejah merged 2 commits intoOct 26, 2026
Merged
Conversation
Resolves Sorokit#919. Resolves Sorokit#920. Resolves Sorokit#921. Resolves Sorokit#935.
|
@ussyalfaks 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 #919, closes #920, closes #921, closes #935
#919: BalanceList fiat conversion, zero-state and issuer tooltip tests
Component change (small):
AssetBadgenow puts the full issuer key in atitletooltip on the truncated issuer line and on the(GA5Z...KZVN)duplicate-code suffix. Before this, the badge showed only the shortened key, so there was no tooltip to test.Tests (
BalanceList.test.tsx):AssetBadgemock can now hand off to the real component, using a hoisted flag andimportOriginal. The issuer tests check the real truncation and tooltip markup, while all existing tests keep the lightweight stub.JPY 200), rounding to two decimals, only native XLM counted, and no fiat figure whenxlmPriceis missing.0 assets,~0 XLM (~€0), no search box). Zero XLM plus zero trustlines (dimmed "No balance" rows). "Hide zero" on an all-zero account (empty state and no Friendbot link). A malformed balance string is treated as 0 and never showsNaN.title. Native XLM has no issuer tooltip. Same-code assets get tooltipped suffixes.#920: ClaimableBalanceCard optimistic removal, clipboard and badge tests
Component change (small):
BalanceRow(and its props type) is now exported, soonClaimedcan be checked directly with a mock. The card's behaviour is unchanged.Tests (
ClaimableBalanceCard.test.tsx):onClaimed: called once with the balance id when the claim succeeds, and only after the claim promise settles. It is not called when the claim returns an error, returns an empty result, or rejects. WithconfirmThreshold, it is only called after the dialog is confirmed. When used standalone, the row shows a "Claimed" badge.navigator.clipboard.writeTextis mocked. The full, untruncated id is copied even though only the truncated id is shown. The ✓ indicator goes back to ⎘ after 1.6s (fake timers). A missing clipboard API does not throw, and copying never starts a claim.timeBoundstart/end,endTime,unconditional,and,orandnotpredicates. A rerender with a latercurrentTimeswitches the row to Expired.#921: SwapSimulator slippage enforcement, flip and chart resizing
amountOut * (1 - slippage / 100), or "—" when the slippage value is invalid. It is enforced at execution: once the simulated confirmation delay ends, the output is re-quoted against the pool as it is then. If it falls below the minimum, the swap is reverted with an inline alert andonSwapis not called.onSwapnow also receivesminAmountOut.ResizeObserveron the price-impact chart container drives the SVG'swidth/height/viewBox. The curve is still plotted on a 0–100 grid inside a scaled<g>, withvector-effect: non-scaling-stroke. The trade marker is drawn in viewport coordinates, so it stays circular after resizes and orientation changes. Zero-size entries are ignored, the observer disconnects on unmount, and environments withoutResizeObserverare skipped. The marker also no longer callsreduceon an empty point list.SwapSimulator.test.tsx): the minimum-received value and how it changes with slippage, the invalid-slippage placeholder,minAmountOutpassed toonSwap, a revert when liquidity drains mid-swap, the flip keeping the amount and re-quoting (plus a double flip), and resize handling using a stubbedResizeObserver(viewBox updates, rounding, ignoring zero sizes, marker coordinates, disconnect).#935: GovernanceDashboard zero votes, prior votes and delegate validation
N% for, or "No votes yet" when there are no votes.userVotefrom the contract payload (validated asyes/no/abstain). Successful votes are also recorded for the current session, keyed by account. Cards show "You voted: Yes/No/Abstain" and disable all vote buttons. The confirm dialog shows the prior vote and disables Confirm, andconfirmVoterefuses to submit a repeat vote.<form>, so pressing Enter goes through the same validation as clicking the button. An empty submit, or clearing a typed value, shows "Enter a delegate address." inline. Malformed addresses keep thevalidateStellarAddresserror, andsubmitDelegationre-checks the address before calling the contract.GovernanceDashboard.test.tsx): zero and malformed vote counts (noNaN, 0% widths), the approval percentage, the recordeduserVotedisabling voting, unknownuserVotevalues being ignored, a duplicate vote blocked after a successful vote, and the empty, cleared, malformed-via-Enter and valid-via-Enter delegate cases.Testing
Per the task rules, nothing was built, linted or run. The tests were written by reading the components and are untested.
Closes #919
Closes #920
Closes #921
Closes #935