flowfi icon indicating copy to clipboard operation
flowfi copied to clipboard

[Testing] Deduplicate the settings test suites and cover untested logic-heavy components

Open blurbeast opened this issue 1 week ago • 5 comments

Overview & Background

One settings component has three separate, non-identical test suites (verified different via checksums): settings-content.test.tsx, __tests__/settings-content.test.tsx, and src/__tests__/settings-content.test.tsx. They drift independently (different mocks, e.g. shortenPublicKey stubs differ) and give false confidence. Meanwhile components with non-trivial pure logic have zero direct coverage: CashflowProjectionChart.tsx (projection math + hover), CashflowChart.tsx, CalendarView.tsx (calendar-grid logic at lines 104-136), WebhookModal.tsx/WebhookDeliveryModal.tsx, and the async webhook page handlers.


Technical Specification & Architecture

  1. Collapse to one settings-content suite (keep the strongest mocks).
  2. Add unit tests for projectCashflow consumers, CalendarView date math, and webhook form/page handlers (mock API, assert error toasts on rejection).

Target Files

  • frontend/src/app/settings/settings-content.test.tsx
  • frontend/src/app/settings/__tests__/settings-content.test.tsx
  • frontend/src/__tests__/settings-content.test.tsx
  • frontend/src/components/dashboard/CashflowProjectionChart.tsx
  • frontend/src/components/dashboard/CalendarView.tsx
  • frontend/src/components/webhooks/

Acceptance Criteria

  • [ ] Exactly one settings-content suite remains.
  • [ ] Projection, calendar, and webhook logic have direct unit tests.
  • [ ] Async handler tests assert rejection paths.

blurbeast avatar Nov 18 '26 19:11 blurbeast

@heymide has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

I can take this on. I've gone through the details and will provide a well-tested solution aligned with the project standards.

ℹ️ Repo Maintainers: To accept this application, review their application or assign @heymide to this issue.

heymide avatar Nov 20 '26 13:11 heymide

@Thobadd has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

Hi maintainer,

I'd like to take a shot at this issue. I went through the checkout flow and looked at the XLM checkout modal component. I can see exactly what's happening when a user rejects the transaction in Freighter — the promise gets rejected, but there's no catch around it. The modal just sits there in its loading state, leaving the user staring at a spinner with no feedback. Since rejecting a transaction is a normal thing to do, the app shouldn't freeze.

My plan is to wrap the Freighter signing call in a try/catch and specifically detect the rejection case. From what I've seen with the Freighter API, user rejection usually comes back as an error containing something like "User declined" or "User rejected the request." I'll check for that pattern to distinguish an intentional rejection from a real failure like a network issue. On rejection, I'll reset the modal's loading state so the UI doesn't freeze and surface a friendly toast like "Transaction rejected in Freighter. No funds were sent." For genuine errors, I'll keep a separate message so we don't conflate the two.

A couple of things I want to get right: first, the loading state needs to be reset in a finally block so we never leave the button disabled if something unexpected throws. Second, I'll make sure the toast component matches the pattern already used in the codebase rather than introducing a new one. I'll also manually verify the flow by rejecting in the Freighter extension to confirm the modal returns to a usable state.

I've contributed to a few React/TypeScript projects before and I'm comfortable with error-handling patterns like this. I'll keep the PR scoped to just this component, and the PR description will include the required closing tag as requested. Happy to adjust the message copy if you have a preferred tone. Let me know if you'd like me to proceed or if there's anything else you want covered in scope.

Thanks

ℹ️ Repo Maintainers: To accept this application, review their application or assign @Thobadd to this issue.

Thobadd avatar Nov 20 '26 16:11 Thobadd

@abercrombie04 has applied to work on this issue as part of the Stellar Wave Program's 11th wave.

i can solve

ℹ️ Repo Maintainers: To accept this application, review their application or assign @abercrombie04 to this issue.

abercrombie04 avatar Nov 21 '26 07:11 abercrombie04

Congratulations, @abercrombie04! 🎉 Your application was accepted by the repo's maintainers, and the issue is due on November 25, 2026.

🧑‍💻 @abercrombie04: Please resolve the issue such that the repo's maintainers have enough time to review your contribution before the due date. You'll earn Points for completing the issue on-time, which will make you eligible for a share of the Stellar Wave Program's reward pool.

[!WARNING] When opening a PR, please link it to this issue to ensure it gets tracked accurately. Points are awarded when this issue is marked as completed by the maintainer.

🤠 Repo maintainers: Please keep an eye on the contributor's progress and review their work before the due date. You can manage this issue, including adjusting its complexity and points, here.

🌊 Happy Wave 🌊

drips-wave[bot] avatar Nov 21 '26 07:11 drips-wave[bot]

This issue has been completed by @abercrombie04 as part of the Stellar Wave Program's 11th Wave 🥳

😎 @abercrombie04: You earned 200 Points for completing this issue! Once the Wave's rewards are finalized, you'll be eligible for a percentage of the Wave's reward pool based on the percentage of total points you've earned. Learn more here. You can also Leave a review to share your experience working on this issue.

🧑‍💻 Repo maintainers: How'd the contributor do? Leave a review to share your experience working with them.

drips-wave[bot] avatar Nov 21 '26 17:11 drips-wave[bot]