chore(analytics): migrate useMetrics→useAnalytics and MetricsEventBuilder→AnalyticsEventBuilder (assets files)#31251
Conversation
…er->AnalyticsEventBuilder, addTraitsToUser->identify (assets files) Migrates 4 asset-owned test files: TokenListItem (useMetrics), DeFiPositionsListItem (MetricsEventBuilder), TokenList and NftDetails (identify rename). Co-authored-by: Cursor <cursoragent@cursor.com>
|
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. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c428e99. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c428e99cf7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…enList mock Co-authored-by: Cursor <cursoragent@cursor.com>
…okenListItem test Co-authored-by: Cursor <cursoragent@cursor.com>

Description
Migrates assets-related test files from the legacy analytics system (
useMetrics,MetricsEventBuilder,addTraitsToUser) to the new system (useAnalytics,AnalyticsEventBuilder,identify).Part of the analytics migration cleanup series. All changes are in files owned by the assets team.
Files migrated:
DeFiPositionsListItem.test.tsx,TokenList.test.tsx,TokenListItem.test.tsx,NftDetails.test.ts.Note:
TokenListItem.test.tsxhas a pre-existing test failure onmainunrelated to this change (tracked by #31019).Changelog
CHANGELOG entry: null
Related issues
Refs: #26686
Manual testing steps
N/A — analytics-only refactor, no behaviour change.
Screenshots/Recordings
Before
N/A
After
N/A
Pre-merge author checklist
Performance checks (if applicable)
Pre-merge reviewer checklist
Made with Cursor
Note
Low Risk
Changes are limited to test mocks and import paths; runtime wallet/assets behavior is unchanged.
Overview
Updates assets-team unit tests so mocks and assertions match the new analytics API—no production code changes.
DeFi / token list tests swap
MetricsEventBuilderforAnalyticsEventBuilder(imports andjest.requireActualpaths underutil/analytics). DeFi navigation analytics expectations now build events withAnalyticsEventBuilder.createEventBuilder.TokenList.test.tsx extends the
useAnalyticsmock withidentifyand a defaultisDataRecordedimplementation so it mirrors the current hook surface.TokenListItem.test.tsx loads
MetaMetricsEventsfromcore/Analyticsinstead of the legacyuseMetricspath for mUSD CTA event assertions.NftDetails.test.ts aligns the
useAnalyticsmock with the new API (identify; drops unused legacy mock fields likeaddTraitsToUser/isDataRecordedwhere no longer needed).Reviewed by Cursor Bugbot for commit e33ebdf. Bugbot is set up for automated code reviews on this repo. Configure here.