Skip to content

Commit bb4e471

Browse files
committed
test(money): assert Earn button uses Primary variant in zero-balance state
The test name claimed a Primary-variant check but only asserted presence, so a Primary->Secondary regression would pass silently. Query the Button element by testID + variant so the design contract is actually verified.
1 parent b87d700 commit bb4e471

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

app/components/UI/Money/components/MoneyBalanceCard/MoneyBalanceCard.test.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from 'react';
22
import { fireEvent } from '@testing-library/react-native';
3+
import { ButtonVariant } from '@metamask/design-system-react-native';
34
import renderWithProvider from '../../../../../util/test/renderWithProvider';
45
import MoneyBalanceCard from './MoneyBalanceCard';
56
import { MoneyBalanceCardTestIds } from './MoneyBalanceCard.testIds';
@@ -133,10 +134,19 @@ describe('MoneyBalanceCard', () => {
133134
});
134135

135136
it('renders the Earn button as a primary variant', () => {
136-
const { getByTestId } = renderWithProvider(<MoneyBalanceCard />);
137+
const { getByTestId, UNSAFE_getByProps } = renderWithProvider(
138+
<MoneyBalanceCard />,
139+
);
137140

138-
const button = getByTestId(MoneyBalanceCardTestIds.EARN_BUTTON);
139-
expect(button).toBeOnTheScreen();
141+
expect(
142+
getByTestId(MoneyBalanceCardTestIds.EARN_BUTTON),
143+
).toBeOnTheScreen();
144+
expect(
145+
UNSAFE_getByProps({
146+
testID: MoneyBalanceCardTestIds.EARN_BUTTON,
147+
variant: ButtonVariant.Primary,
148+
}),
149+
).toBeTruthy();
140150
});
141151

142152
it('opens the Add money sheet (and not the Money home) when Earn is pressed', () => {

0 commit comments

Comments
 (0)