test: cover sell confirmation modal payout display and mutation outcomes - #715
Merged
Chucks1093 merged 1 commit intoJul 28, 2026
Conversation
…mes (accesslayerorg#692) Adds the coverage the issue asks for across the two components actually involved: TradeDialog (payout display, bonding curve call, disabled-prop) and LandingPage's handleConfirmTrade (the sell mutation outcome wiring — TradeDialog itself holds no mutation or toast state). - TradeDialog.sellPayoutDisplay.test.tsx: correct estimated XLM payout for a given quantity, payout updates as quantity changes, "unavailable" fallback when price/supply are missing, estimateSellProceeds (the bonding curve calculation) called with the right arguments, no payout computed on the buy side, confirm/cancel disabled while isSubmitting, onConfirm receives the parsed quantity. - LandingPage.sellConfirmationModal.integration.test.tsx: confirm button disabled while the sell is in flight and re-enabled once it settles; modal stays open with an inline error toast on failure (rather than closing as if it succeeded) and holdings are left unchanged. Failure is injected via showToast.loading throwing once, which exercises the real catch-block path in handleConfirmTrade — the sell branch doesn't run through tradeMutation (it's a hardcoded simulated delay), so this is the one legitimate seam without inventing behavior that doesn't exist. Verified against the full suite via git stash: 34 pre-existing failing test files (localStorage/jsdom shadowing on newer Node versions, unrelated to this component) are identical before/after — 11 new tests added, 0 regressions.
|
@Ejere 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.
Summary
Adds the unit/integration test coverage requested for the sell key confirmation modal, split across the two components actually involved:
TradeDialog(the presentational modal) andLandingPage'shandleConfirmTrade(the sell mutation outcome wiring —TradeDialogitself holds no mutation or toast state of its own).closes #692
Changes
src/components/common/__tests__/TradeDialog.sellPayoutDisplay.test.tsx: correct estimated XLM payout displayed for a given sell quantity, payout updates as quantity changes, "Estimated proceeds unavailable" fallback when price/supply are missing,estimateSellProceeds(the bonding curve calculation) asserted called with the correct arguments, no payout computed on the buy side, confirm/cancel disabled whileisSubmitting,onConfirmreceives the parsed quantity.src/pages/__tests__/LandingPage.sellConfirmationModal.integration.test.tsx: confirm button disabled while the sell is in flight and re-enabled once it settles; modal stays open with an inline error toast on failure (rather than closing as if it had succeeded) and holdings are left unchanged. Failure is injected viashowToast.loadingthrowing once — the sell branch doesn't route throughtradeMutation(it's a hardcoded simulated delay, unlike buy), so mocking the loading-toast call is the one legitimate seam into the realcatchblock inhandleConfirmTradewithout inventing a failure mode that doesn't exist for this path today.Test plan
TradeDialogunit tests + 2 newLandingPageintegration tests, all passing.git stash -ubefore/after comparison: 34 pre-existing failing test files (90 failing tests — alocalStorage/jsdom shadowing issue on newer Node versions, affecting components unrelated to this change) are identical before and after. 0 regressions, 11 new passing tests.