Test: Implement Component: Transaction History (Grid View) Data Formatting - #526
Open
AdaBliss wants to merge 1 commit into
Open
Test: Implement Component: Transaction History (Grid View) Data Formatting#526AdaBliss wants to merge 1 commit into
AdaBliss wants to merge 1 commit into
Conversation
…tting Add the cross-border transaction history grid view and tests for how it formats data. No transaction history component existed in the codebase, so this adds the presentational component under test alongside the suite. Every value on a card goes through shared formatters, so a card and a list row can never disagree about how an amount or an escrow status reads. Amounts are shown with their asset or ISO currency code rather than a locale symbol: corridor currencies share symbols (several use the dollar sign) and Intl symbol output varies with the host ICU build. - lib/transactionFormatters: grouped amounts with stellar 7dp precision, direction signing, escrow status labels and badge styles, corridor and date formatting, with em-dash placeholders for missing or non-finite values so a bad feed cannot print NaN - 24 grid tests covering amount and escrow formatting, card content, the details action and the empty state - 25 unit tests pinning the formatters directly
|
@AdaBliss 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! 🚀 |
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.
closes #506
Summary
Adds the cross-border transaction history grid view and tests for how it formats currency amounts and escrow statuses in the cards.
A note on scope: the repository has no transaction history component.
types/transaction.tscovers Stellar transaction tracking, andDeliveryList/ExpandableDeliveryRowcover deliveries, but there is nothing that renders a user's cross-border transfer history as cards. Since the issue asks to test formatting in the grid cards, this PR adds the presentational component under test alongside the suite. Happy to rework it if you already have a design or a data contract in mind for this surface.Changes
types/transactionHistory.ts-CrossBorderTransactionshape, reusing the existingEscrowStatusunion fromtypes/status.ts.lib/transactionFormatters.ts- the single source of truth for how history data reads, so a card and a list row can never disagree:Intlcurrency symbol output varies with the host ICU build, so a symbol-based format would differ between a developer machine and CI.0.0000001and1250.5both render correctly.-for sent,+for received) so a card reads like a ledger entry.NOT_LOCKEDnever reaches the user, plus distinct badge styles per status.NaNorInfinityinto a card.features/transactions/components/TransactionHistoryGrid.tsx- responsive card grid; every displayed value goes through the formatters above. Cards carry stabledata-testidhooks and the escrow badge has an accessible label.Test coverage
features/transactions/components/__tests__/TransactionHistoryGrid.test.tsx(24 tests). Pure presentational component, so no API, socket or wallet mocking is needed.-and incoming+; the asset code (XLMvsUSDC) shown alongside the amount; sub-cent Stellar precision preserved (+0.0000001 XLM); a large amount rendered without scientific notation (+12,345,678.90 XLM); the local-currency leg with its ISO code (1,234,567.80 NGN); an em-dash placeholder when no fiat quote is attached;NaNfrom the feed never printed; a zero-value transfer rendered as a real amount rather than blank.LOCKED,RELEASED,DISPUTED,NOT_LOCKEDrenders its readable label; the underscored wire value never appears in the card; the badge carries an accessible label; the four statuses are styled distinctly so they are visually separable.lib/__tests__/transactionFormatters.test.ts(25 tests) pins the formatters directly, including rounding past 7 decimals, negative and zero amounts, non-finite guards, theUnknownfallback for an unrecognised status, and badge-style uniqueness.Verification
npx jest features/transactions lib/__tests__/transactionFormatters.test.ts- 49 tests passing.main.npx eslinton the new files - clean.npx tsc --noEmit- no errors from this change.types/transactionHistory.tsandlib/transactionFormatters.tsare shared with the list-view PR for #505 and are byte-identical in both branches, so the two merge cleanly in either order (verified locally with a trial merge).Note for the maintainer
maincurrently fails the CIType CheckandBuild Verificationsteps for an unrelated reason:components/mobile/MobileFooter.tsxlanded with its string quotes stripped (line 1 is a backtick-quoteduse client, and imports readimport React from react), which tripsTS1160: Unterminated template literal. It came in with #318 and is present onmainindependently of this PR, so it will show red here and on every other open PR until it is fixed. I left it alone to keep this PR scoped to the issue; happy to open a separate fix PR if that would help.