Conversation
|
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.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Test asserts wrong background color token
- Updated the test to expect background.alternative to match the component and styles using theme.colors.background.alternative.
Or push these changes by commenting:
@cursor push a3e931cd35
Preview (a3e931cd35)
diff --git a/app/components/UI/Earn/Views/EarnLendingWithdrawalConfirmationView/EarnLendingWithdrawalConfirmationView.test.tsx b/app/components/UI/Earn/Views/EarnLendingWithdrawalConfirmationView/EarnLendingWithdrawalConfirmationView.test.tsx
--- a/app/components/UI/Earn/Views/EarnLendingWithdrawalConfirmationView/EarnLendingWithdrawalConfirmationView.test.tsx
+++ b/app/components/UI/Earn/Views/EarnLendingWithdrawalConfirmationView/EarnLendingWithdrawalConfirmationView.test.tsx
@@ -235,7 +235,7 @@
expect.any(Object), // theme.colors
{
hasCancelButton: false,
- backgroundColor: mockTheme.colors.background.section,
+ backgroundColor: mockTheme.colors.background.alternative,
},
{
backButtonEvent: {
...n/Views/EarnLendingWithdrawalConfirmationView/EarnLendingWithdrawalConfirmationView.test.tsx
Outdated
Show resolved
Hide resolved
...mponents/PoolStakingLearnMoreModal/InteractiveTimespanChart/GraphCursor/GraphCursor.test.tsx
Outdated
Show resolved
Hide resolved
|
@cursoragent update PR description to align with template. Also add update to eslintrc file see other exampels |
|
6fe8fa1 to
2d15ee5
Compare
2d15ee5 to
faf8c6c
Compare
| 'app/components/UI/Ramp/**/*.{js,jsx,ts,tsx}', | ||
| 'app/components/UI/Rewards/**/*.{js,jsx,ts,tsx}', | ||
| 'app/components/UI/Perps/**/*.{js,jsx,ts,tsx}', | ||
| 'app/components/UI/Earn/**/*.{js,jsx,ts,tsx}', |
There was a problem hiding this comment.
Earn and Stake UI now falls under the same `@metamask/design-tokens/color-no-hex` enforcement as Card, Ramp, Rewards, and the other listed areas, so new hex in those trees fails lint at author time instead of only in tests or unrelated folders.
| import { EarningsHistoryChart } from './EarningsHistoryChart'; | ||
| import { fireLayoutEvent } from '../../../../../../../util/testUtils/react-native-svg-charts'; | ||
| import { lightTheme } from '@metamask/design-tokens'; | ||
| import { mockTheme } from '../../../../../../../util/theme'; |
There was a problem hiding this comment.
Bar fill expectations should track the same theme surface the app uses via util/theme, not a second import path that could drift when tokens or wiring change. This keeps chart assertions coupled to the runtime theme contract while avoiding raw hex in the spec.
| hasNoTimeout: true, | ||
| iconColor: '#000000', | ||
| backgroundColor: '#FFFFFF', | ||
| iconColor: mockTheme.colors.icon.default, |
There was a problem hiding this comment.
These objects mirror what the hook passes into useEarnToasts
|
|
||
| const INACTIVE_COLOR = lightTheme.colors.background.default; | ||
| const ACTIVE_COLOR = lightTheme.colors.background.muted; | ||
| const INACTIVE_COLOR = mockTheme.colors.background.default; |
There was a problem hiding this comment.
The component styles active/inactive spans with semantic background tokens. Asserting against mockTheme keeps the test aligned with the same palette as production code and avoids embedding hex now that Stake paths are linted with color-no-hex.
| const MOCK_X = () => 73; | ||
| const MOCK_Y = () => 33.17441726994484; | ||
| const MOCK_COLOR = '#1c8234'; | ||
| const MOCK_COLOR = mockTheme.brandColors.green600; |
There was a problem hiding this comment.
The previous literal matched the product green used on the chart cursor. mockTheme.brandColors.green600 preserves that intent through the brand scale so the snapshot and prop contract stay on tokens and pass color-no-hex in Stake UI.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Autofix Details
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Likely undefined
brandColors.green600property access- Replaced undefined mockTheme.brandColors.green600 with mockTheme.colors.success.default so a valid color token is passed.
- ✅ Fixed: Unfixed hex literals break newly enabled lint rule
- Replaced '#000000' and '#FFFFFF' with mockTheme.colors.icon.default and mockTheme.colors.background.default to comply with color-no-hex.
Or push these changes by commenting:
@cursor push 266707f1dd
Preview (266707f1dd)
diff --git a/app/components/UI/Earn/hooks/useMusdConversionStatus.test.ts b/app/components/UI/Earn/hooks/useMusdConversionStatus.test.ts
--- a/app/components/UI/Earn/hooks/useMusdConversionStatus.test.ts
+++ b/app/components/UI/Earn/hooks/useMusdConversionStatus.test.ts
@@ -186,8 +186,8 @@
variant: ToastVariants.Icon as const,
iconName: IconName.Danger,
hasNoTimeout: false,
- iconColor: '#000000',
- backgroundColor: '#FFFFFF',
+ iconColor: mockTheme.colors.icon.default,
+ backgroundColor: mockTheme.colors.background.default,
hapticsType: NotificationFeedbackType.Error,
labelOptions: [{ label: 'Withdrawal failed', isBold: true }],
}),
diff --git a/app/components/UI/Stake/components/PoolStakingLearnMoreModal/InteractiveTimespanChart/GraphCursor/GraphCursor.test.tsx b/app/components/UI/Stake/components/PoolStakingLearnMoreModal/InteractiveTimespanChart/GraphCursor/GraphCursor.test.tsx
--- a/app/components/UI/Stake/components/PoolStakingLearnMoreModal/InteractiveTimespanChart/GraphCursor/GraphCursor.test.tsx
+++ b/app/components/UI/Stake/components/PoolStakingLearnMoreModal/InteractiveTimespanChart/GraphCursor/GraphCursor.test.tsx
@@ -12,7 +12,7 @@
const MOCK_CURRENT_X = 2;
const MOCK_X = () => 73;
const MOCK_Y = () => 33.17441726994484;
- const MOCK_COLOR = mockTheme.brandColors.green600;
+ const MOCK_COLOR = mockTheme.colors.success.default;
it('render matches snapshot', () => {
const props: GraphCursorProps = {
...mponents/PoolStakingLearnMoreModal/InteractiveTimespanChart/GraphCursor/GraphCursor.test.tsx
Show resolved
Hide resolved
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Toast mock colors collapsed to identical values
- Updated success and failed toast mocks to use mockTheme.colors.success.default and mockTheme.colors.error.default matching production.
Or push these changes by commenting:
@cursor push 3461b83d9c
Preview (3461b83d9c)
diff --git a/app/components/UI/Earn/hooks/useMerklClaimStatus.test.ts b/app/components/UI/Earn/hooks/useMerklClaimStatus.test.ts
--- a/app/components/UI/Earn/hooks/useMerklClaimStatus.test.ts
+++ b/app/components/UI/Earn/hooks/useMerklClaimStatus.test.ts
@@ -105,7 +105,7 @@
variant: ToastVariants.Icon as const,
iconName: IconName.CheckBold,
hasNoTimeout: false,
- iconColor: mockTheme.colors.icon.default,
+ iconColor: mockTheme.colors.success.default,
backgroundColor: mockTheme.colors.background.default,
hapticsType: NotificationFeedbackType.Success,
labelOptions: [{ label: 'Your mUSD is here!', isBold: true }],
@@ -114,7 +114,7 @@
variant: ToastVariants.Icon as const,
iconName: IconName.CircleX,
hasNoTimeout: false,
- iconColor: mockTheme.colors.icon.default,
+ iconColor: mockTheme.colors.error.default,
backgroundColor: mockTheme.colors.background.default,
hapticsType: NotificationFeedbackType.Error,
labelOptions: [{ label: 'Bonus claim failed', isBold: true }],
diff --git a/app/components/UI/Earn/hooks/useMusdConversionStatus.test.ts b/app/components/UI/Earn/hooks/useMusdConversionStatus.test.ts
--- a/app/components/UI/Earn/hooks/useMusdConversionStatus.test.ts
+++ b/app/components/UI/Earn/hooks/useMusdConversionStatus.test.ts
@@ -137,7 +137,7 @@
variant: ToastVariants.Icon as const,
iconName: IconName.CheckBold,
hasNoTimeout: false,
- iconColor: mockTheme.colors.icon.default,
+ iconColor: mockTheme.colors.success.default,
backgroundColor: mockTheme.colors.background.default,
hapticsType: NotificationFeedbackType.Success,
labelOptions: [{ label: 'Success', isBold: true }],
@@ -146,7 +146,7 @@
variant: ToastVariants.Icon as const,
iconName: IconName.Danger,
hasNoTimeout: false,
- iconColor: mockTheme.colors.icon.default,
+ iconColor: mockTheme.colors.error.default,
backgroundColor: mockTheme.colors.background.default,
hapticsType: NotificationFeedbackType.Error,
labelOptions: [{ label: 'Failed', isBold: true }],
@@ -166,7 +166,7 @@
variant: ToastVariants.Icon as const,
iconName: IconName.CheckBold,
hasNoTimeout: false,
- iconColor: mockTheme.colors.icon.default,
+ iconColor: mockTheme.colors.success.default,
backgroundColor: mockTheme.colors.background.default,
hapticsType: NotificationFeedbackType.Success,
labelOptions: [{ label: 'Success', isBold: true }],
@@ -175,7 +175,7 @@
variant: ToastVariants.Icon as const,
iconName: IconName.Danger,
hasNoTimeout: false,
- iconColor: mockTheme.colors.icon.default,
+ iconColor: mockTheme.colors.error.default,
backgroundColor: mockTheme.colors.background.default,
hapticsType: NotificationFeedbackType.Error,
labelOptions: [{ label: 'Bonus claim failed', isBold: true }],
@@ -186,7 +186,7 @@
variant: ToastVariants.Icon as const,
iconName: IconName.Danger,
hasNoTimeout: false,
- iconColor: mockTheme.colors.icon.default,
+ iconColor: mockTheme.colors.error.default,
backgroundColor: mockTheme.colors.background.default,
hapticsType: NotificationFeedbackType.Error,
labelOptions: [{ label: 'Withdrawal failed', isBold: true }],2337506 to
bdd871a
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #27151 +/- ##
==========================================
+ Coverage 77.80% 82.44% +4.63%
==========================================
Files 4802 4801 -1
Lines 123906 123806 -100
Branches 27594 27598 +4
==========================================
+ Hits 96410 102073 +5663
+ Misses 20523 14665 -5858
- Partials 6973 7068 +95 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bdd871a to
55b1a5e
Compare
55b1a5e to
496965f
Compare
🔍 Smart E2E Test Selection⏭️ Smart E2E selection skipped - draft PR All E2E tests pre-selected. |
|
✅ E2E Fixture Validation — Schema is up to date |
|







Description
Test-only refactor to remove hard-coded hex colors from Earn/Stake test suites and align with the
@metamask/design-tokens/color-no-hexrule by using the sharedmockThemeand brand tokens. No production logic changes.mockTheme.colors.background.alternativeto match production.useMerklClaimStatus.test.tsreplaces hex values withmockTheme.colors.icon.defaultandmockTheme.colors.background.default.GraphCursor.test.tsxusesmockTheme.brandColors.green600instead of a hex literal.@metamask/design-tokens/color-no-hexaserrorforapp/components/UI/Earn/**/*andapp/components/UI/Stake/**/*to keep these areas compliant going forward.Changelog
CHANGELOG entry: null
Related issues
Split from #26651 to reduce CODEOWNERS fanout.
Manual testing steps
Screenshots/Recordings
N/A
Pre-merge author checklist