Skip to content

test: cover sell confirmation modal payout display and mutation outcomes - #715

Merged
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
Ejere:test/sell-confirmation-modal-payout-display
Jul 28, 2026
Merged

test: cover sell confirmation modal payout display and mutation outcomes#715
Chucks1093 merged 1 commit into
accesslayerorg:devfrom
Ejere:test/sell-confirmation-modal-payout-display

Conversation

@Ejere

@Ejere Ejere commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

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) and LandingPage's handleConfirmTrade (the sell mutation outcome wiring — TradeDialog itself holds no mutation or toast state of its own).

closes #692

Changes

  • Add unit tests for the sell key confirmation modal correctly displaying the estimated XLM payout #692 — Sell confirmation modal tests:
    • 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 while isSubmitting, onConfirm receives 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 via showToast.loading throwing once — the sell branch doesn't route through tradeMutation (it's a hardcoded simulated delay, unlike buy), so mocking the loading-toast call is the one legitimate seam into the real catch block in handleConfirmTrade without inventing a failure mode that doesn't exist for this path today.

Test plan

  • 9 new TradeDialog unit tests + 2 new LandingPage integration tests, all passing.
  • Full suite run via git stash -u before/after comparison: 34 pre-existing failing test files (90 failing tests — a localStorage/jsdom shadowing issue on newer Node versions, affecting components unrelated to this change) are identical before and after. 0 regressions, 11 new passing tests.

…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.
@drips-wave

drips-wave Bot commented Jul 28, 2026

Copy link
Copy Markdown

@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! 🚀

Learn more about application limits

@Chucks1093
Chucks1093 merged commit d03534c into accesslayerorg:dev Jul 28, 2026
1 check passed
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.

Add unit tests for the sell key confirmation modal correctly displaying the estimated XLM payout

2 participants