Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: STAKE-803 integrate unstake method from sdk #11962

Merged
merged 8 commits into from
Oct 24, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { backgroundState } from '../../../../../util/test/initial-root-state';
import configureMockStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import { StakeConfirmationViewProps } from './StakeConfirmationView.types';
import { MOCK_POOL_STAKING_SDK } from '../../__mocks__/mockData';

jest.mock('../../../../hooks/useIpfsGateway', () => jest.fn());

Expand Down Expand Up @@ -60,6 +61,11 @@ jest.mock('../../hooks/usePoolStakedDeposit', () => ({
}),
}));

jest.mock('../../hooks/useStakeContext', () => ({
__esModule: true,
useStakeContext: jest.fn(() => MOCK_POOL_STAKING_SDK),
}));

jest.mock('../../hooks/usePooledStakes', () => ({
__esModule: true,
default: () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -638,18 +638,146 @@ exports[`StakeConfirmationView render matches snapshot 1`] = `
}
}
>
<SvgMock
color="#141618"
height={16}
name="Question"
<View
style={
{
"backgroundColor": "#ffffff",
"borderRadius": 8,
"height": 16,
"overflow": "hidden",
"width": 16,
}
}
width={16}
/>
>
<View
style={
[
{
"overflow": "hidden",
},
{
"backgroundColor": "#1593F2",
"borderRadius": 8,
"height": 16,
"width": 16,
},
undefined,
]
}
>
<RNSVGSvgView
bbHeight={16}
bbWidth={16}
focusable={false}
height={16}
style={
[
{
"backgroundColor": "transparent",
"borderWidth": 0,
},
{
"flex": 0,
"height": 16,
"width": 16,
},
]
}
width={16}
>
<RNSVGGroup
fill={
{
"payload": 4278190080,
"type": 0,
}
}
>
<RNSVGRect
fill={
{
"payload": 4280574177,
"type": 0,
}
}
height={16}
matrix={
[
-0.14608302856241107,
0.9892723329629884,
-0.9892723329629884,
-0.14608302856241107,
18.877507984599454,
-1.41266974682138,
]
}
propList={
[
"fill",
]
}
width={16}
x={0}
y={0}
/>
<RNSVGRect
fill={
{
"payload": 4294395137,
"type": 0,
}
}
height={16}
matrix={
[
-0.02094241988335673,
-0.9997806834748455,
0.9997806834748455,
-0.02094241988335673,
-7.512435753557014,
20.161960644608932,
]
}
propList={
[
"fill",
]
}
width={16}
x={0}
y={0}
/>
<RNSVGRect
fill={
{
"payload": 4294736640,
"type": 0,
}
}
height={16}
matrix={
[
-0.458649554484315,
0.8886172326549487,
-0.8886172326549487,
-0.458649554484315,
14.2400072574634,
19.300266514976617,
]
}
propList={
[
"fill",
]
}
width={16}
x={0}
y={0}
/>
</RNSVGGroup>
</RNSVGSvgView>
</View>
</View>
<View
accessible={false}
style={
Expand Down Expand Up @@ -1342,6 +1470,7 @@ exports[`StakeConfirmationView render matches snapshot 1`] = `
accessibilityRole="button"
accessible={true}
activeOpacity={1}
disabled={false}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down Expand Up @@ -1383,6 +1512,8 @@ exports[`StakeConfirmationView render matches snapshot 1`] = `
accessibilityRole="button"
accessible={true}
activeOpacity={1}
disabled={false}
loading={false}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -545,15 +545,15 @@ exports[`StakeInputView render matches snapshot 1`] = `
>
<SvgMock
color="#6a737d"
height={20}
height={16}
name="Question"
style={
{
"height": 20,
"width": 20,
"height": 16,
"width": 16,
}
}
width={20}
width={16}
/>
</TouchableOpacity>
</View>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Image } from 'react-native';
import { createMockAccountsControllerState } from '../../../../../util/test/accountsControllerTestUtils';
import { backgroundState } from '../../../../../util/test/initial-root-state';
import { UnstakeConfirmationViewProps } from './UnstakeConfirmationView.types';
import { MOCK_POOL_STAKING_SDK } from '../../__mocks__/mockData';

const MOCK_ADDRESS_1 = '0x0';
const MOCK_ADDRESS_2 = '0x1';
Expand Down Expand Up @@ -58,6 +59,11 @@ jest.mock('../../hooks/usePooledStakes', () => ({
}),
}));

jest.mock('../../hooks/useStakeContext', () => ({
__esModule: true,
useStakeContext: jest.fn(() => MOCK_POOL_STAKING_SDK),
}));

describe('UnstakeConfirmationView', () => {
it('render matches snapshot', () => {
const props: UnstakeConfirmationViewProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -863,18 +863,146 @@ exports[`UnstakeConfirmationView render matches snapshot 1`] = `
}
}
>
<SvgMock
color="#141618"
height={16}
name="Question"
<View
style={
{
"backgroundColor": "#ffffff",
"borderRadius": 8,
"height": 16,
"overflow": "hidden",
"width": 16,
}
}
width={16}
/>
>
<View
style={
[
{
"overflow": "hidden",
},
{
"backgroundColor": "#1593F2",
"borderRadius": 8,
"height": 16,
"width": 16,
},
undefined,
]
}
>
<RNSVGSvgView
bbHeight={16}
bbWidth={16}
focusable={false}
height={16}
style={
[
{
"backgroundColor": "transparent",
"borderWidth": 0,
},
{
"flex": 0,
"height": 16,
"width": 16,
},
]
}
width={16}
>
<RNSVGGroup
fill={
{
"payload": 4278190080,
"type": 0,
}
}
>
<RNSVGRect
fill={
{
"payload": 4280574177,
"type": 0,
}
}
height={16}
matrix={
[
-0.14608302856241107,
0.9892723329629884,
-0.9892723329629884,
-0.14608302856241107,
18.877507984599454,
-1.41266974682138,
]
}
propList={
[
"fill",
]
}
width={16}
x={0}
y={0}
/>
<RNSVGRect
fill={
{
"payload": 4294395137,
"type": 0,
}
}
height={16}
matrix={
[
-0.02094241988335673,
-0.9997806834748455,
0.9997806834748455,
-0.02094241988335673,
-7.512435753557014,
20.161960644608932,
]
}
propList={
[
"fill",
]
}
width={16}
x={0}
y={0}
/>
<RNSVGRect
fill={
{
"payload": 4294736640,
"type": 0,
}
}
height={16}
matrix={
[
-0.458649554484315,
0.8886172326549487,
-0.8886172326549487,
-0.458649554484315,
14.2400072574634,
19.300266514976617,
]
}
propList={
[
"fill",
]
}
width={16}
x={0}
y={0}
/>
</RNSVGGroup>
</RNSVGSvgView>
</View>
</View>
<View
accessible={false}
style={
Expand Down Expand Up @@ -1303,6 +1431,7 @@ exports[`UnstakeConfirmationView render matches snapshot 1`] = `
accessibilityRole="button"
accessible={true}
activeOpacity={1}
disabled={false}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down Expand Up @@ -1344,6 +1473,8 @@ exports[`UnstakeConfirmationView render matches snapshot 1`] = `
accessibilityRole="button"
accessible={true}
activeOpacity={1}
disabled={false}
loading={false}
onPress={[Function]}
onPressIn={[Function]}
onPressOut={[Function]}
Expand Down
Loading
Loading