Skip to content

Add comprehensive unit tests for transfer and quote contracts, status… - #292

Open
Ayom04 wants to merge 2 commits into
RemitFlow:mainfrom
Ayom04:feat/contract-transfer
Open

Add comprehensive unit tests for transfer and quote contracts, status…#292
Ayom04 wants to merge 2 commits into
RemitFlow:mainfrom
Ayom04:feat/contract-transfer

Conversation

@Ayom04

@Ayom04 Ayom04 commented Aug 23, 2026

Copy link
Copy Markdown

This pull request introduces several improvements to how transfer statuses and monetary amounts are handled and displayed throughout the application. It enhances accessibility and robustness by normalizing status values, improving error handling for contract violations, and ensuring all monetary values are formatted consistently. Additionally, the visual representation of transfer statuses has been expanded and refined across the UI and print styles.

Status handling and display improvements:

  • Expanded the set of transfer statuses to include quoted, validating, authorizing, expired, and an explicit unknown state, with human-readable labels and descriptions. Status normalization ensures consistent display and filtering, even for legacy or provider-specific spellings. (src/components/StatusBadge.jsx [1] src/components/StatusBadge.stories.jsx [2] [3] src/pages/Transfers.jsx [4] [5] [6]
  • Updated status badge styles for all new states, including high-contrast and print-friendly variants, and added a distinct style for unknown statuses. (src/components/StatusBadge.css [1] [2] [3] src/print.css [4]

Monetary amount formatting:

  • Replaced all uses of formatAmount with formatMoney throughout the UI to ensure consistent currency formatting and to handle unparseable values gracefully. (src/components/QuoteCard.jsx [1] [2] [3] src/components/TransferRow.jsx [4] [5] src/pages/Transfers.jsx [6] [7]

Error handling and contract validation:

  • Improved error handling for contract violations: if transfer data fails schema validation, users now see a clear error message instead of a generic failure, and the app avoids displaying misleading empty lists or submitting invalid transfers. (src/hooks/useTransfers.js [1] [2] src/pages/SendMoney.jsx [3] [4] src/services/api.js [5]

Storybook and documentation updates:

  • Updated Storybook stories for StatusBadge to cover all statuses, legacy spellings, and unknown states, ensuring that component documentation stays in sync with contract definitions. (src/components/StatusBadge.stories.jsx [1] [2]

These changes collectively improve the reliability, accessibility, and maintainability of the application's handling and display of transfer statuses and amounts.
closes #282

Ayom04 added 2 commits August 23, 2026 16:36
… badges, and money utilities

- Implement tests for StatusBadge component to ensure correct rendering of transfer statuses and aliases.
- Create tests for contract schema validation, covering various scenarios including valid and invalid payloads.
- Add tests for money utility functions to validate parsing, formatting, and arithmetic operations on monetary values.
- Introduce tests for quote contract parsing and fee calculation, ensuring accurate handling of quotes and associated rates.
- Develop tests for receipt rendering components to verify correct display of transfer and quote information.
- Ensure robust handling of breaking changes in transfer and quote contracts with actionable error messages.
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.

test(frontend): add contract-driven tests for transfer, quote, and error states

1 participant