diff --git a/app/components/UI/Stake/components/StakingBalance/StakingBalance.test.tsx b/app/components/UI/Stake/components/StakingBalance/StakingBalance.test.tsx
index 1b57391b954..86c20d242fb 100644
--- a/app/components/UI/Stake/components/StakingBalance/StakingBalance.test.tsx
+++ b/app/components/UI/Stake/components/StakingBalance/StakingBalance.test.tsx
@@ -1,26 +1,16 @@
import React from 'react';
-import { fireEvent, screen } from '@testing-library/react-native';
-import { renderScreen } from '../../../../../util/test/renderWithProvider';
-import { backgroundState } from '../../../../../util/test/initial-root-state';
+import { fireEvent } from '@testing-library/react-native';
+import renderWithProvider from '../../../../../util/test/renderWithProvider';
import StakingBalance from './StakingBalance';
import { strings } from '../../../../../../locales/i18n';
import Routes from '../../../../../constants/navigation/Routes';
+import { Image } from 'react-native';
-function render(Component: React.ComponentType) {
- return renderScreen(
- Component,
- {
- name: 'Asset',
- },
- {
- state: {
- engine: {
- backgroundState,
- },
- },
- },
- );
-}
+jest.mock('../../../../hooks/useIpfsGateway', () => jest.fn());
+
+Image.getSize = jest.fn((_uri, success) => {
+ success(100, 100); // Mock successful response for ETH native Icon Image
+});
const mockNavigate = jest.fn();
@@ -34,15 +24,17 @@ jest.mock('@react-navigation/native', () => {
};
});
describe('StakingBalance', () => {
+ beforeEach(() => jest.resetAllMocks());
+
it('render matches snapshot', () => {
- render(StakingBalance);
- expect(screen.toJSON()).toMatchSnapshot();
+ const { toJSON } = renderWithProvider();
+ expect(toJSON()).toMatchSnapshot();
});
it('redirects to StakeInputView on stake button click', () => {
- render(StakingBalance);
+ const { getByText } = renderWithProvider();
- fireEvent.press(screen.getByText(strings('stake.stake_more')));
+ fireEvent.press(getByText(strings('stake.stake_more')));
expect(mockNavigate).toHaveBeenCalledTimes(1);
expect(mockNavigate).toHaveBeenCalledWith('StakeScreens', {
diff --git a/app/components/UI/Stake/components/StakingBalance/StakingCta/__snapshots__/StakingCta.test.tsx.snap b/app/components/UI/Stake/components/StakingBalance/StakingCta/__snapshots__/StakingCta.test.tsx.snap
index 82348eab2d1..1ca4cc04c0d 100644
--- a/app/components/UI/Stake/components/StakingBalance/StakingCta/__snapshots__/StakingCta.test.tsx.snap
+++ b/app/components/UI/Stake/components/StakingBalance/StakingCta/__snapshots__/StakingCta.test.tsx.snap
@@ -53,6 +53,7 @@ exports[`StakingCta render matches snapshot 1`] = `
"fontWeight": "400",
"letterSpacing": 0,
"lineHeight": 22,
+ "paddingRight": 3,
}
}
>
@@ -68,7 +69,6 @@ exports[`StakingCta render matches snapshot 1`] = `
"fontWeight": "400",
"letterSpacing": 0,
"lineHeight": 22,
- "paddingRight": 3,
}
}
>
diff --git a/app/components/UI/Stake/components/StakingBalance/__snapshots__/StakingBalance.test.tsx.snap b/app/components/UI/Stake/components/StakingBalance/__snapshots__/StakingBalance.test.tsx.snap
index 1d017c20f6b..ee2fbde051b 100644
--- a/app/components/UI/Stake/components/StakingBalance/__snapshots__/StakingBalance.test.tsx.snap
+++ b/app/components/UI/Stake/components/StakingBalance/__snapshots__/StakingBalance.test.tsx.snap
@@ -1,924 +1,613 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`StakingBalance render matches snapshot 1`] = `
-
-
+
-
+
+
+ >
+
+
+
+
-
-
-
- Asset
-
-
+ }
+ testID="network-avatar-image"
+ />
-
+ Staked Ethereum
+
+
-
+ $13,292.20
+
+
-
+
+
+
+
+
+
-
+
+
+ Unstaking 0.0010 ETH in progress. Come back in 11 days to claim it.
+
+
+
+
+
+
+
+
+
-
+
+
-
+
+
+
+
+
+ Stake ETH and earn
+
+
+
+ Stake your ETH with MetaMask Pool and earn
+
+
+ 2.9%
+
+
+ annually.
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Staked Ethereum
-
-
-
- $13,292.20
-
-
- 4.9999 ETH
-
-
-
-
-
-
-
-
-
-
- Unstaking 0.0010 ETH in progress. Come back in 11 days to claim it.
-
-
-
-
-
-
-
-
-
- You can claim 0.00214 ETH. Once claimed, you'll get ETH back in your wallet.
-
-
-
- Claim
- ETH
-
-
-
-
-
-
- Stake ETH and earn
-
-
-
- Stake your ETH with MetaMask Pool and earn
-
-
- 2.9%
-
-
- annually.
-
-
-
- Learn more.
-
-
-
-
-
-
-
- Unstake
-
-
-
-
- Stake more
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ }
+ >
+ Learn more.
+
+
+
+
+
+
+
+ Unstake
+
+
+
+
+ Stake more
+
+
+
+
`;