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. |
The committed fixture schema is out of date. To update, comment: |
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: Undefined reference to renamed import
TEST_HEX_COLORS- Replaced incorrect
TEST_HEX_COLORSreferences with the correctly importedmockTestHexColorsin the test assertions.
- Replaced incorrect
Or push these changes by commenting:
@cursor push ed339bf6fc
Preview (ed339bf6fc)
diff --git a/app/components/UI/Predict/hooks/usePredictClaim.test.ts b/app/components/UI/Predict/hooks/usePredictClaim.test.ts
--- a/app/components/UI/Predict/hooks/usePredictClaim.test.ts
+++ b/app/components/UI/Predict/hooks/usePredictClaim.test.ts
@@ -202,8 +202,8 @@
},
],
iconName: IconName.Error,
- iconColor: TEST_HEX_COLORS.ERROR_DARK,
- backgroundColor: TEST_HEX_COLORS.ACCENT_BLUE,
+ iconColor: mockTestHexColors.ERROR_DARK,
+ backgroundColor: mockTestHexColors.ACCENT_BLUE,
hasNoTimeout: false,
linkButtonOptions: {
label: strings('predict.claim.toasts.error.try_again'),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: Inconsistent hex color handling in ChartLegend test
- Replaced hardcoded hex colors with TEST_HEX_COLORS constants and removed inline lint suppressions.
Or push these changes by commenting:
@cursor push 6b7fa01195
Preview (6b7fa01195)
diff --git a/app/components/UI/Predict/components/PredictDetailsChart/components/ChartLegend.test.tsx b/app/components/UI/Predict/components/PredictDetailsChart/components/ChartLegend.test.tsx
--- a/app/components/UI/Predict/components/PredictDetailsChart/components/ChartLegend.test.tsx
+++ b/app/components/UI/Predict/components/PredictDetailsChart/components/ChartLegend.test.tsx
@@ -2,6 +2,7 @@
import renderWithProvider from '../../../../../../util/test/renderWithProvider';
import ChartLegend from './ChartLegend';
import { ChartSeries } from '../PredictDetailsChart';
+import { TEST_HEX_COLORS } from '../../../testUtils/mockColors';
jest.mock('../utils', () => ({
formatTickValue: jest.fn((value: number, range: number) => {
@@ -22,8 +23,7 @@
const mockSingleSeries: ChartSeries[] = [
{
label: 'Outcome A',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#4459FF',
+ color: TEST_HEX_COLORS.CHART_PRIMARY,
data: [
{ timestamp: 1640995200000, value: 0.5 },
{ timestamp: 1640998800000, value: 0.6 },
@@ -35,8 +35,7 @@
const mockMultipleSeries: ChartSeries[] = [
{
label: 'Outcome A',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#4459FF',
+ color: TEST_HEX_COLORS.CHART_PRIMARY,
data: [
{ timestamp: 1640995200000, value: 0.5 },
{ timestamp: 1640998800000, value: 0.6 },
@@ -45,8 +44,7 @@
},
{
label: 'Outcome B',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#FF6B6B',
+ color: TEST_HEX_COLORS.CHART_CORAL,
data: [
{ timestamp: 1640995200000, value: 0.3 },
{ timestamp: 1640998800000, value: 0.2 },
@@ -135,8 +133,7 @@
const seriesWithEmptyData: ChartSeries[] = [
{
label: 'Empty Series',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#4459FF',
+ color: TEST_HEX_COLORS.CHART_PRIMARY,
data: [],
},
];
@@ -207,8 +204,7 @@
const seriesWithEmptyData: ChartSeries[] = [
{
label: 'Empty',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#4459FF',
+ color: TEST_HEX_COLORS.CHART_PRIMARY,
data: [],
},
];
@@ -222,8 +218,7 @@
const seriesWithSinglePoint: ChartSeries[] = [
{
label: 'Single Point',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#4459FF',
+ color: TEST_HEX_COLORS.CHART_PRIMARY,
data: [{ timestamp: 1640995200000, value: 0.42 }],
},
];
@@ -256,8 +251,7 @@
const seriesWithSmallValues: ChartSeries[] = [
{
label: 'Small',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#4459FF',
+ color: TEST_HEX_COLORS.CHART_PRIMARY,
data: [{ timestamp: 1640995200000, value: 0.001 }],
},
];
@@ -274,8 +268,7 @@
const seriesWithLargeValues: ChartSeries[] = [
{
label: 'Large',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#4459FF',
+ color: TEST_HEX_COLORS.CHART_PRIMARY,
data: [{ timestamp: 1640995200000, value: 999.99 }],
},
];
@@ -311,8 +304,7 @@
const seriesWithDifferentLengths: ChartSeries[] = [
{
label: 'Long',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#4459FF',
+ color: TEST_HEX_COLORS.CHART_PRIMARY,
data: [
{ timestamp: 1, value: 0.1 },
{ timestamp: 2, value: 0.2 },
@@ -321,8 +313,7 @@
},
{
label: 'Short',
- // eslint-disable-next-line @metamask/design-tokens/color-no-hex
- color: '#FF6B6B',
+ color: TEST_HEX_COLORS.CHART_CORAL,
data: [{ timestamp: 1, value: 0.5 }],
},
];
app/components/UI/Predict/components/PredictDetailsChart/components/ChartLegend.test.tsx
Outdated
Show resolved
Hide resolved
...t/components/PredictGameDetailsContent/__snapshots__/PredictGameDetailsContent.test.tsx.snap
Outdated
Show resolved
Hide resolved
| }, | ||
| }, | ||
| { | ||
| files: ['app/components/UI/Predict/**/*.{js,jsx,ts,tsx}'], |
There was a problem hiding this comment.
This folder-level override is the key rollout guardrail: it enforces the rule for Predict while broader test migrations continue. Keeping the scope isolated to Predict lowers merge risk and makes rollback straightforward if CI uncovers missed literals.
| * Keep hardcoded test-only colors in this file to avoid repeated | ||
| * `color-no-hex` suppressions across test suites. | ||
| */ | ||
| export const TEST_HEX_COLORS = { |
There was a problem hiding this comment.
This file keeps Predict-specific static test colors in one place so individual tests can stay readable without repeating rule suppressions. Keeping the suppression scoped here also makes it easy to audit and remove later if tokenized fixtures are introduced.
| @@ -1,4 +1,5 @@ | |||
| import { NavigationProp } from '@react-navigation/native'; | |||
| import { TEST_HEX_COLORS as mockTestHexColors } from '../testUtils/mockColors'; | |||
There was a problem hiding this comment.
The mock-prefixed alias is intentional here because Jest mock factories are hoisted and can only safely reference imported values when they follow the mock naming convention. This keeps the test aligned with centralized color fixtures while avoiding scope/hoist issues in the factory.
| import renderWithProvider from '../../../../../../util/test/renderWithProvider'; | ||
| import ChartLegend from './ChartLegend'; | ||
| import { ChartSeries } from '../PredictDetailsChart'; | ||
| import { TEST_HEX_COLORS } from '../../../testUtils/mockColors'; |
There was a problem hiding this comment.
This import keeps chart fixture colors consistent with the shared Predict test palette so updates happen in one place instead of drifting across chart tests.
This reverts commit 97c941f.
186dfd3 to
99e9156
Compare
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: Theme mock missing
accent04crashes hook initialization- Updated usePredictDeposit.test to mock theme colors with accent04 and error paths, preventing undefined access during hook initialization.
Or push these changes by commenting:
@cursor push 873cdee03f
Preview (873cdee03f)
diff --git a/app/components/UI/Predict/hooks/usePredictDeposit.test.ts b/app/components/UI/Predict/hooks/usePredictDeposit.test.ts
--- a/app/components/UI/Predict/hooks/usePredictDeposit.test.ts
+++ b/app/components/UI/Predict/hooks/usePredictDeposit.test.ts
@@ -4,6 +4,7 @@
import Logger from '../../../../util/Logger';
import { PredictTradeStatus } from '../constants/eventNames';
import { ConfirmationLoader } from '../../../Views/confirmations/components/confirm/confirm-component';
+import { TEST_HEX_COLORS as mockTestHexColors } from '../testUtils/mockColors';
const mockGoBack = jest.fn();
const mockNavigateToConfirmation = jest.fn();
@@ -32,12 +33,18 @@
error: jest.fn(),
}));
-jest.mock('../../../../util/theme', () => {
- const { mockTheme } = jest.requireActual('../../../../util/theme');
- return {
- useAppThemeFromContext: () => mockTheme,
- };
-});
+jest.mock('../../../../util/theme', () => ({
+ useAppThemeFromContext: jest.fn(() => ({
+ colors: {
+ error: {
+ default: mockTestHexColors.ERROR_DARK,
+ },
+ accent04: {
+ normal: mockTestHexColors.ACCENT_BLUE,
+ },
+ },
+ })),
+}));
jest.mock('../../../../component-library/components/Toast', () => {
const actualReact = jest.requireActual('react');
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsE2E Test Selection:
Why no E2E tests are needed:
This is a low-risk code quality improvement that doesn't require E2E validation. Performance Test Selection: |
|




Description
This PR is the Predict-only split of the
color-no-hexbatch work, extracted from the original umbrella PR #26651 and the previously combined batch branch.Scope:
app/components/UI/Predict/**)app/components/UI/Predict/**/*.{js,jsx,ts,tsx}Reference PR: #26651
Changelog
CHANGELOG entry: null
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
N/A (test/lint/config updates only)
After
N/A (test/lint/config updates only)
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Low Risk
Primarily test-only refactors plus an ESLint override for
app/components/UI/Predict; low runtime risk, but it may surface new lint failures if any remaining hex colors exist in that folder.Overview
Enables
@metamask/design-tokens/color-no-hexenforcement forapp/components/UI/Predict/**/*via an ESLint override.Refactors Predict unit tests to comply by replacing inline hex strings with a new shared
TEST_HEX_COLORSfixture and by standardizing theme mocks to reusemockThemefromapp/util/theme(including updating a few toast/theme color mocks).Written by Cursor Bugbot for commit 99e9156. This will update automatically on new commits. Configure here.