Skip to content

Commit f99d56d

Browse files
committed
test(rewards): resolve merge conflict markers in RewardsSettingsView.test.tsx and restore mocks (safe-area, theme, design-system, navbar)
1 parent f780018 commit f99d56d

File tree

1 file changed

+68
-10
lines changed

1 file changed

+68
-10
lines changed

app/components/UI/Rewards/Views/RewardsSettingsView.test.tsx

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ jest.mock('@react-navigation/native', () => {
2525
};
2626
});
2727

28-
<<<<<<< HEAD
29-
// Mock react-native-safe-area-context (override SafeAreaView only; keep SafeAreaProvider etc. for stack)
30-
jest.mock('react-native-safe-area-context', () => {
31-
const React = jest.requireActual('react');
32-
const { View } = jest.requireActual('react-native');
33-
const actual = jest.requireActual('react-native-safe-area-context');
34-
=======
3528
// Mock theme
3629
jest.mock('../../../../util/theme', () => {
3730
const { mockTheme } = jest.requireActual('../../../../util/theme');
@@ -45,10 +38,75 @@ jest.mock('../../Navbar', () => ({
4538
getNavigationOptionsTitle: jest.fn(() => ({ title: 'Settings' })),
4639
}));
4740

48-
// Mock design system components
41+
// Mock design system components (minimal set used by header)
4942
jest.mock('@metamask/design-system-react-native', () => {
50-
const { View, Text } = jest.requireActual('react-native');
51-
>>>>>>> 30bd473975 (test: migrate color-no-hex for rewards codeowner batch)
43+
const ReactActual = jest.requireActual('react');
44+
const {
45+
View,
46+
Text: RNText,
47+
TouchableOpacity,
48+
} = jest.requireActual('react-native');
49+
return {
50+
Box: ({
51+
children,
52+
testID,
53+
...props
54+
}: {
55+
children?: React.ReactNode;
56+
testID?: string;
57+
[key: string]: unknown;
58+
}) => ReactActual.createElement(View, { testID, ...props }, children),
59+
Text: ({
60+
children,
61+
...props
62+
}: {
63+
children?: React.ReactNode;
64+
[key: string]: unknown;
65+
}) => ReactActual.createElement(RNText, props, children),
66+
ButtonIcon: ({
67+
onPress,
68+
testID,
69+
isDisabled,
70+
...props
71+
}: {
72+
onPress?: () => void;
73+
testID?: string;
74+
isDisabled?: boolean;
75+
[key: string]: unknown;
76+
}) =>
77+
ReactActual.createElement(TouchableOpacity, {
78+
onPress,
79+
testID,
80+
disabled: isDisabled,
81+
...props,
82+
}),
83+
// Enums/constants used by components
84+
IconName: {
85+
ArrowLeft: 'arrow-left',
86+
Close: 'close',
87+
},
88+
ButtonIconSize: {
89+
Md: 'md',
90+
Lg: 'lg',
91+
},
92+
TextVariant: {
93+
BodyMd: 'BodyMd',
94+
BodySm: 'BodySm',
95+
},
96+
FontWeight: {
97+
Bold: 'bold',
98+
},
99+
BoxAlignItems: {
100+
Center: 'center',
101+
},
102+
};
103+
});
104+
105+
// Mock react-native-safe-area-context (override SafeAreaView only; keep SafeAreaProvider etc. for stack)
106+
jest.mock('react-native-safe-area-context', () => {
107+
const React = jest.requireActual('react');
108+
const { View } = jest.requireActual('react-native');
109+
const actual = jest.requireActual('react-native-safe-area-context');
52110
return {
53111
...actual,
54112
useSafeAreaInsets: jest.fn(() => ({

0 commit comments

Comments
 (0)