Test: Implement Component: Transaction History (List View) Empty States - #525
Open
AdaBliss wants to merge 1 commit into
Open
Test: Implement Component: Transaction History (List View) Empty States#525AdaBliss wants to merge 1 commit into
AdaBliss wants to merge 1 commit into
Conversation
Add the cross-border transaction history list view and its component tests. No transaction history component existed in the codebase, so this adds the presentational component under test alongside the suite. The list renders four mutually exclusive states. The empty state is split in two on purpose: a first-time user with no transfers gets a friendly invitation to send one, while a user whose filters exclude everything gets a distinct message and a way back to the full history. A blank panel in either case would leave the user unsure whether the app had failed. - types/transactionHistory: CrossBorderTransaction shape - lib/transactionFormatters: amount, escrow status, corridor and date formatting, using ISO codes rather than locale symbols so output does not vary with the host ICU build - 20 tests covering both empty states, loading, error, retry and the populated list
|
@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 #505
Summary
Adds the cross-border transaction history list view and its component tests, with the empty states as the focus.
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. Since the issue asks to verify that a friendly empty state renders when the user has no cross-border transactions, 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 (reference, direction, counterparty, settlement amount and asset code, optional local-fiat quote, corridor countries, escrow status, timestamp), reusing the existingEscrowStatusunion fromtypes/status.ts.lib/transactionFormatters.ts- shared display formatting for amounts, escrow status labels and badge styles, corridors and dates. Amounts are rendered as a grouped number plus the ISO asset or currency code rather than a localised symbol: corridor currencies collide on symbols (several use the dollar sign) andIntlcurrency symbols vary with the host ICU build, which would make output differ between a developer machine and CI. Missing or non-finite values render as an em dash, so a bad feed cannot printNaNinto the UI.features/transactions/components/TransactionHistoryList.tsx- chronological list view rendering four mutually exclusive states: loading, error, empty, populated.The empty state is deliberately split in two. A first-time user with no transfers needs an invitation to send one; a user whose filters happen to exclude everything needs to be told it is the filters and given a way back to the full history. Collapsing both into one message would tell the second user their account is empty, which is wrong and actively confusing.
Test coverage
features/transactions/components/__tests__/TransactionHistoryList.test.tsx(20 tests). Pure presentational component, so no mocking of APIs, sockets or wallets is required; callbacks are asserted withjest.fn()viauserEvent.Clear filtersfires its handler, and the filtered variant disappears once results exist again.role="status"with anaria-labelandaria-live, and loading takes precedence over an error so states never stack.alert, retry fires its handler, the retry button is hidden without a handler, and the error still wins over cached rows.-1,250.50 XLMvs+800.00 XLM), an em-dash placeholder when a corridor has no fiat quote, and a single-item history that does not fall back to the empty state.Verification
npx jest features/transactions- 20 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 grid-view PR for #506 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.