Skip to content

test: cover usePlatformFee, campaign hooks, DonationModal, and WithdrawFunds#446

Merged
overprodigy merged 25 commits into
Iris-IV:mainfrom
0x860:fix/test-issues-405-410
May 29, 2026
Merged

test: cover usePlatformFee, campaign hooks, DonationModal, and WithdrawFunds#446
overprodigy merged 25 commits into
Iris-IV:mainfrom
0x860:fix/test-issues-405-410

Conversation

@0x860
Copy link
Copy Markdown
Contributor

@0x860 0x860 commented May 29, 2026

Summary

  • Add unit tests for usePlatformFee covering on-chain fee reads, 300 bps fallback, isFallback, loading, and fee/net preview math.
  • Add unit tests for useCampaign and useCampaigns covering loading, error, notFound, and refetch transitions; expose notFound on useCampaign.
  • Add unit tests for WithdrawFunds covering fee/net breakdown, goal-not-reached guard, already-withdrawn state, creator-only visibility, and 3% default fee.
  • Add unit tests for DonationModal covering amount validation, platform fee explanation, stroop conversion on submit, and pending-state UI; surface platform fee disclosure in the modal.

Verification

  • npm test -- --testPathPatterns="usePlatformFee|useCampaign|WithdrawFunds|DonationModal" --no-coverage — 22 tests passed across 5 suites.

Closes #405
Closes #406
Closes #409
Closes #410

Made with Cursor

0x860 and others added 25 commits May 29, 2026 22:22
Verify usePlatformFee returns the live get_platform_fee value when the
contract getter succeeds.

Co-authored-by: Cursor <cursoragent@cursor.com>
When get_platform_fee is unavailable the hook must surface the documented
300 bps default per CONTRACT_INTEGRATION.md.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cover the isFallback flag so UI can distinguish live fee reads from the
300 bps default path.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ensure consumers can show a loading indicator while get_platform_fee resolves.

Co-authored-by: Cursor <cursoragent@cursor.com>
Confirm the returned basis points drive correct fee/net breakdown values
used by withdrawal and detail previews.

Co-authored-by: Cursor <cursoragent@cursor.com>
Align the hook with CONTRACT_INTEGRATION.md so detail pages can distinguish
an unknown id from a still-loading query.

Co-authored-by: Cursor <cursoragent@cursor.com>
Cover the happy path where get_campaign resolves and the hook leaves the
loading state with campaign data.

Co-authored-by: Cursor <cursoragent@cursor.com>
Verify query failures surface an error message without marking the campaign
as not found.

Co-authored-by: Cursor <cursoragent@cursor.com>
When get_campaign returns null the hook should expose notFound so detail
pages can render a 404-style state.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ensure refetch triggers a fresh get_campaign call and updates hook state.

Co-authored-by: Cursor <cursoragent@cursor.com>
Verify getAllCampaigns populates the campaigns array after the initial query
resolves.

Co-authored-by: Cursor <cursoragent@cursor.com>
Verify list fetch failures surface an error without leaving stale campaign
data behind.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ensure invalidateQueries triggers a fresh getAllCampaigns call and refreshes
the campaigns array.

Co-authored-by: Cursor <cursoragent@cursor.com>
Only the campaign creator should see the withdrawal panel; other wallets
render nothing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Confirm total raised, platform fee, and creator net amounts render correctly
from the supplied basis points.

Co-authored-by: Cursor <cursoragent@cursor.com>
Disable the withdraw button and show FundingGoalNotReached guidance when
amount_raised is below funding_goal.

Co-authored-by: Cursor <cursoragent@cursor.com>
When funds_withdrawn is true the panel must stay disabled with a clear
already-withdrawn message.

Co-authored-by: Cursor <cursoragent@cursor.com>
When platformFeeBps is omitted the component should use the documented 300
bps default for fee/net previews.

Co-authored-by: Cursor <cursoragent@cursor.com>
Surface the withdrawal-time platform fee so the contribution form matches
CONTRACT_INTEGRATION contributor transparency requirements.

Co-authored-by: Cursor <cursoragent@cursor.com>
Reject zero contribution amounts by keeping the donate button disabled.

Co-authored-by: Cursor <cursoragent@cursor.com>
Keep submit disabled for invalid ContributionMustBePositive inputs including
negative values and non-numeric strings.

Co-authored-by: Cursor <cursoragent@cursor.com>
Verify contributors see the withdrawal-time platform fee disclosure in the
modal.

Co-authored-by: Cursor <cursoragent@cursor.com>
Ensure the submit flow converts XLM input to stroops before calling the
contract client.

Co-authored-by: Cursor <cursoragent@cursor.com>
Replace the donate button with the pending state while contribute is
in flight so duplicate submissions cannot be sent.

Co-authored-by: Cursor <cursoragent@cursor.com>
Fix platform fee label matching for split spans and wait for isFallback
instead of isLoading when get_platform_fee retries once.

Co-authored-by: Cursor <cursoragent@cursor.com>
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@0x860 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

@sshdopey
Copy link
Copy Markdown
Contributor

Auto-review failed (API error). Leaving PR for human review.

@overprodigy overprodigy merged commit f12a4cb into Iris-IV:main May 29, 2026
3 of 8 checks 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

3 participants