metamask-mobile icon indicating copy to clipboard operation
metamask-mobile copied to clipboard

test: add unit tests for TransactionDetailsSheet component

Open PatrykLucka opened this issue 5 months ago • 3 comments

Description

Adds a co-located unit test for TransactionDetailsSheet to cover the live transaction selector path. The sheet now has regression coverage proving it uses the latest transaction metadata from Redux when selectTransactionMetadataById finds a matching transaction, and falls back to the route transaction when Redux does not have a match.

The test renders the real sheet/header/details component tree and asserts the displayed transaction date follows the selected transaction source.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-881

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • [ ] I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • [ ] I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • [ ] I've instrumented key operations with Sentry traces for production performance metrics
    • See trace() for usage and addToken for an example

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

[!NOTE] Low Risk Test-only addition with no runtime or user-facing behavior changes.

Overview Adds a new co-located test file for TransactionDetailsSheet with no production code changes.

The tests render the real sheet via renderScreen, stub navigation route params and toDateFormat, and seed TransactionController transactions in Redux. They lock in two behaviors: when selectTransactionMetadataById finds a matching id, the UI shows the live transaction timestamp (not stale route data or unrelated txs); when Redux has no match, it falls back to the route tx.

Reviewed by Cursor Bugbot for commit 973203a734db07e1c8323cac04bd64e570da98a2. Bugbot is set up for automated code reviews on this repo. Configure here.

PatrykLucka avatar Jun 25 '26 13:06 PatrykLucka

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

github-actions[bot] avatar Jun 25 '26 13:06 github-actions[bot]

PR template — items to address before "Ready for review"

Warnings — informational, address before merging:

  • Manual testing steps still contain template content (the Gherkin example title or a [...] placeholder). Replace with real steps, or write N/A — <reason>.
  • Screenshots/Recordings section is empty. Add an image/video for user-facing changes, logs/console output for non-user-facing changes, or write N/A if no evidence is applicable.
  • Pre-merge author checklist has unchecked items (e.g. "I've tested on Android"). Every box must be consciously checked — see docs/readme/ready-for-review.md.

See docs/readme/ready-for-review.md for the full Definition of Ready for Review.

metamask-ci avatar Jun 25 '26 13:06 metamask-ci