test: cover usePlatformFee, campaign hooks, DonationModal, and WithdrawFunds#446
Merged
Conversation
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>
|
@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! 🚀 |
Contributor
|
Auto-review failed (API error). Leaving PR for human review. |
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
usePlatformFeecovering on-chain fee reads, 300 bps fallback,isFallback, loading, and fee/net preview math.useCampaignanduseCampaignscovering loading, error, notFound, and refetch transitions; exposenotFoundonuseCampaign.WithdrawFundscovering fee/net breakdown, goal-not-reached guard, already-withdrawn state, creator-only visibility, and 3% default fee.DonationModalcovering 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