Skip to content

[Component View Tests] Move getTrendingTokens behind a controller to eliminate direct service mock in component-view tests #26270

@pnarayanaswamy

Description

@pnarayanaswamy

What is this about?

The component-view test framework's mock policy restricts mocks to Engine and react-native-device-info only. However, getTrendingTokens from @metamask/assets-controllers is a standalone service function called directly from components (e.g. via useTrendingSearch), not through a controller on Engine.

Because it's not exposed via Engine, there's no way to drive its behavior through Redux state in tests. This forces a manual jest.mock('@metamask/assets-controllers', ...) in the shared mocks.ts — an anti-pattern for this test framework.

Stakeholder review needed before the work gets merged

  • Engineering (needed in most cases)
  • Design
  • Product
  • QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
  • Security
  • Legal
  • Marketing
  • Management (please specify)
  • Other (please specify)

Metadata

Metadata

Assignees

No one assigned

    Labels

    INVALID-ISSUE-TEMPLATEIssue's body doesn't match any issue template.release-7.71.0Issue or pull request that will be included in release 7.71.0team-assetstype-bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    To be triaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions