Skip to content

Commit 6b7fa01

Browse files
committed
test(predict): replace hardcoded hex colors in ChartLegend.test.tsx with TEST_HEX_COLORS constants and remove inline eslint disables
1 parent 2d432a8 commit 6b7fa01

File tree

1 file changed

+11
-20
lines changed

1 file changed

+11
-20
lines changed

app/components/UI/Predict/components/PredictDetailsChart/components/ChartLegend.test.tsx

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import renderWithProvider from '../../../../../../util/test/renderWithProvider';
33
import ChartLegend from './ChartLegend';
44
import { ChartSeries } from '../PredictDetailsChart';
5+
import { TEST_HEX_COLORS } from '../../../testUtils/mockColors';
56

67
jest.mock('../utils', () => ({
78
formatTickValue: jest.fn((value: number, range: number) => {
@@ -22,8 +23,7 @@ describe('ChartLegend', () => {
2223
const mockSingleSeries: ChartSeries[] = [
2324
{
2425
label: 'Outcome A',
25-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
26-
color: '#4459FF',
26+
color: TEST_HEX_COLORS.CHART_PRIMARY,
2727
data: [
2828
{ timestamp: 1640995200000, value: 0.5 },
2929
{ timestamp: 1640998800000, value: 0.6 },
@@ -35,8 +35,7 @@ describe('ChartLegend', () => {
3535
const mockMultipleSeries: ChartSeries[] = [
3636
{
3737
label: 'Outcome A',
38-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
39-
color: '#4459FF',
38+
color: TEST_HEX_COLORS.CHART_PRIMARY,
4039
data: [
4140
{ timestamp: 1640995200000, value: 0.5 },
4241
{ timestamp: 1640998800000, value: 0.6 },
@@ -45,8 +44,7 @@ describe('ChartLegend', () => {
4544
},
4645
{
4746
label: 'Outcome B',
48-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
49-
color: '#FF6B6B',
47+
color: TEST_HEX_COLORS.CHART_CORAL,
5048
data: [
5149
{ timestamp: 1640995200000, value: 0.3 },
5250
{ timestamp: 1640998800000, value: 0.2 },
@@ -135,8 +133,7 @@ describe('ChartLegend', () => {
135133
const seriesWithEmptyData: ChartSeries[] = [
136134
{
137135
label: 'Empty Series',
138-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
139-
color: '#4459FF',
136+
color: TEST_HEX_COLORS.CHART_PRIMARY,
140137
data: [],
141138
},
142139
];
@@ -207,8 +204,7 @@ describe('ChartLegend', () => {
207204
const seriesWithEmptyData: ChartSeries[] = [
208205
{
209206
label: 'Empty',
210-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
211-
color: '#4459FF',
207+
color: TEST_HEX_COLORS.CHART_PRIMARY,
212208
data: [],
213209
},
214210
];
@@ -222,8 +218,7 @@ describe('ChartLegend', () => {
222218
const seriesWithSinglePoint: ChartSeries[] = [
223219
{
224220
label: 'Single Point',
225-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
226-
color: '#4459FF',
221+
color: TEST_HEX_COLORS.CHART_PRIMARY,
227222
data: [{ timestamp: 1640995200000, value: 0.42 }],
228223
},
229224
];
@@ -256,8 +251,7 @@ describe('ChartLegend', () => {
256251
const seriesWithSmallValues: ChartSeries[] = [
257252
{
258253
label: 'Small',
259-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
260-
color: '#4459FF',
254+
color: TEST_HEX_COLORS.CHART_PRIMARY,
261255
data: [{ timestamp: 1640995200000, value: 0.001 }],
262256
},
263257
];
@@ -274,8 +268,7 @@ describe('ChartLegend', () => {
274268
const seriesWithLargeValues: ChartSeries[] = [
275269
{
276270
label: 'Large',
277-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
278-
color: '#4459FF',
271+
color: TEST_HEX_COLORS.CHART_PRIMARY,
279272
data: [{ timestamp: 1640995200000, value: 999.99 }],
280273
},
281274
];
@@ -311,8 +304,7 @@ describe('ChartLegend', () => {
311304
const seriesWithDifferentLengths: ChartSeries[] = [
312305
{
313306
label: 'Long',
314-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
315-
color: '#4459FF',
307+
color: TEST_HEX_COLORS.CHART_PRIMARY,
316308
data: [
317309
{ timestamp: 1, value: 0.1 },
318310
{ timestamp: 2, value: 0.2 },
@@ -321,8 +313,7 @@ describe('ChartLegend', () => {
321313
},
322314
{
323315
label: 'Short',
324-
// eslint-disable-next-line @metamask/design-tokens/color-no-hex
325-
color: '#FF6B6B',
316+
color: TEST_HEX_COLORS.CHART_CORAL,
326317
data: [{ timestamp: 1, value: 0.5 }],
327318
},
328319
];

0 commit comments

Comments
 (0)