Skip to content

Commit aa517e9

Browse files
committed
Fix lint
1 parent dbdf7b3 commit aa517e9

File tree

2 files changed

+34
-29
lines changed

2 files changed

+34
-29
lines changed

ui/components/app/rewards/RewardsPointsBalance.test.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ import React from 'react';
22
import { render, screen } from '@testing-library/react';
33
import '@testing-library/jest-dom';
44
import { useSelector } from 'react-redux';
5-
import { RewardsPointsBalance } from './RewardsPointsBalance';
65
import { useI18nContext } from '../../../hooks/useI18nContext';
76
import { useRewardsContext } from '../../../contexts/rewards';
87
import type { RewardsContextValue } from '../../../contexts/rewards';
9-
import type { SeasonStatusState } from '../../../../app/scripts/controllers/rewards/rewards-controller.types';
8+
import { RewardsPointsBalance } from './RewardsPointsBalance';
109

1110
// Mock dependencies
1211
jest.mock('react-redux', () => ({
@@ -39,14 +38,20 @@ const mockUseRewardsContext = useRewardsContext as jest.MockedFunction<
3938

4039
describe('RewardsPointsBalance', () => {
4140
const mockT = jest.fn((key: string, values?: string[]) => {
42-
if (key === 'rewardsOptIn') return 'Opt In';
43-
if (key === 'rewardsPointsBalance' && values) return `${values[0]} points`;
44-
if (key === 'rewardsPointsIcon') return 'Rewards Points Icon';
41+
if (key === 'rewardsOptIn') {
42+
return 'Opt In';
43+
}
44+
if (key === 'rewardsPointsBalance' && values) {
45+
return `${values[0]} points`;
46+
}
47+
if (key === 'rewardsPointsIcon') {
48+
return 'Rewards Points Icon';
49+
}
4550
return key;
4651
});
4752

4853
// Mock season status with complete structure
49-
const mockSeasonStatus: SeasonStatusState = {
54+
const mockSeasonStatus = {
5055
season: {
5156
id: 'test-season',
5257
name: 'Test Season',

ui/components/app/rewards/RewardsPointsBalance.tsx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,29 @@ import { getIntlLocale } from '../../../ducks/locale/locale';
66
import { useRewardsContext } from '../../../contexts/rewards';
77
import { Skeleton } from '../../component-library/skeleton';
88

9+
const RewardsBadge = ({ text }: { text: string }) => {
10+
const t = useI18nContext();
11+
12+
return (
13+
<Box
14+
className="flex items-center gap-2 px-2 bg-background-muted rounded"
15+
data-testid="rewards-points-balance"
16+
>
17+
<img
18+
src="./images/metamask-rewards-points.svg"
19+
alt={t('rewardsPointsIcon')}
20+
style={{ width: '16px', height: '16px' }}
21+
/>
22+
<Text
23+
variant={TextVariant.BodySm}
24+
data-testid="rewards-points-balance-value"
25+
>
26+
{text}
27+
</Text>
28+
</Box>
29+
);
30+
};
31+
932
/**
1033
* Component to display the rewards points balance
1134
* Shows the points balance with an icon for users who haven't opted in yet
@@ -41,26 +64,3 @@ export const RewardsPointsBalance = () => {
4164

4265
return <RewardsBadge text={t('rewardsPointsBalance', [formattedPoints])} />;
4366
};
44-
45-
const RewardsBadge = ({ text }: { text: string }) => {
46-
const t = useI18nContext();
47-
48-
return (
49-
<Box
50-
className="flex items-center gap-2 px-2 bg-background-muted rounded"
51-
data-testid="rewards-points-balance"
52-
>
53-
<img
54-
src="./images/metamask-rewards-points.svg"
55-
alt={t('rewardsPointsIcon')}
56-
style={{ width: '16px', height: '16px' }}
57-
/>
58-
<Text
59-
variant={TextVariant.BodySm}
60-
data-testid="rewards-points-balance-value"
61-
>
62-
{text}
63-
</Text>
64-
</Box>
65-
);
66-
};

0 commit comments

Comments
 (0)