Skip to content

Commit

Permalink
chore: update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
nickewansmith committed Jan 16, 2025
1 parent 81d265a commit deb4649
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions app/components/Views/WalletActions/WalletActions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ import {
} from '../../../util/test/accountsControllerTestUtils';
import useStakingChain from '../../UI/Stake/hooks/useStakingChain';
import Engine from '../../../core/Engine';
import { isStablecoinLendingFeatureEnabled } from '../../UI/Stake/constants';

jest.mock('../../../components/UI/Stake/constants', () => ({
isStablecoinLendingFeatureEnabled: jest.fn(),
}));

jest.mock('../../../core/Engine', () => ({
context: {
Expand Down Expand Up @@ -117,6 +122,14 @@ describe('WalletActions', () => {
expect(
getByTestId(WalletActionsBottomSheetSelectorsIDs.BRIDGE_BUTTON),
).toBeDefined();
});

it('should render earn button if the stablecoin lending feature is enabled', () => {
(isStablecoinLendingFeatureEnabled as jest.Mock).mockReturnValue(true);
const { getByTestId } = renderWithProvider(<WalletActions />, {
state: mockInitialState,
});

expect(
getByTestId(WalletActionsBottomSheetSelectorsIDs.EARN_BUTTON),
).toBeDefined();
Expand Down Expand Up @@ -217,6 +230,7 @@ describe('WalletActions', () => {
expect(mockNavigate).toHaveBeenCalled();
});
it('should call the onEarn function when the Earn button is pressed', () => {
(isStablecoinLendingFeatureEnabled as jest.Mock).mockReturnValue(true);
const { getByTestId } = renderWithProvider(<WalletActions />, {
state: mockInitialState,
});
Expand All @@ -232,6 +246,7 @@ describe('WalletActions', () => {
});

it('should switch to mainnet when onEarn called on unsupported staking network', () => {
(isStablecoinLendingFeatureEnabled as jest.Mock).mockReturnValue(true);
(useStakingChain as jest.Mock).mockReturnValue({
isStakingSupportedChain: false,
});
Expand Down

0 comments on commit deb4649

Please sign in to comment.