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

Jon/smol-4.12 #5201

Merged
merged 9 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

- added: `CryptoIcon` logo support to displayed request QR codes
- added: Initial implementation of `SceneHeaderUi4`
- added: App distribution via Zealot
- added: Add disableSurveyModal option
- added: dRPC api key option for EVM chains
Expand All @@ -10,6 +12,12 @@
- changed: Disable Home scene swap and FIO cards if configured
- changed: Allow some chains to be disabled in env.json
- changed: Add more metadata to zealot upload
- changed: Token swap error demoted to red error dropdown to a toast
- changed: 1 cent minimum requirement for high fee warning
- fixed: Cutoff UI in `CreateWalletImportScene` when keyboard open
- fixed: Unecessary eye icon in `CreateWalletImportScene` text input field
- fixed: PoweredBy card displaying custom system fonts
- fixed: Inconsistent button UI in `SwapSuccessScene`
- fixed: Keyboard remaining visible when opening the side menu
- fixed: Do not spin forever if the spam filter eliminates too many transactions.
- fixed: FIO OBT data not showing in received transaction memos
Expand Down
69 changes: 61 additions & 8 deletions src/__tests__/scenes/SwapSuccessScene.test.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,72 @@
import { describe, expect, it } from '@jest/globals'
import { EdgeCurrencyInfo } from 'edge-core-js'
import * as React from 'react'
import { createRenderer } from 'react-test-renderer/shallow'
import TestRenderer from 'react-test-renderer'

import { SwapSuccessSceneComponent } from '../../components/scenes/SwapSuccessScene'
import { getTheme } from '../../components/services/ThemeContext'
import { SwapSuccessScene } from '../../components/scenes/SwapSuccessScene'
import { FakeProviders, FakeState } from '../../util/fake/FakeProviders'
import { fakeSceneProps } from '../../util/fake/fakeSceneProps'

const currencyInfo: EdgeCurrencyInfo = {
pluginId: 'bitcoin',
currencyCode: 'BTC',
displayName: 'Bitcoin',
walletType: 'bitcoin',

addressExplorer: '',
transactionExplorer: '',

defaultSettings: {},
metaTokens: [],
denominations: [
{
name: 'BTC',
multiplier: '100000000',
symbol: '₿'
}
]
}

const fakeCurrencyConfig: any = {
currencyInfo,
allTokens: {},
builtinTokens: {},
customTokens: {}
}

const fakeCoreWallet: any = {
balanceMap: new Map([[null, '123123']]),
blockHeight: 12345,
currencyConfig: fakeCurrencyConfig,
currencyInfo,
enabledTokenIds: [],
fiatCurrencyCode: 'iso:USD',
id: '123',
name: 'wallet name',
type: 'wallet:bitcoin',
watch() {}
}

describe('SwapSuccessSceneComponent', () => {
it('should render with loading props', () => {
const renderer = createRenderer()

const fakeDisklet: any = {}
const fakeState: FakeState = {
core: {
account: {
id: '',
currencyWallets: { '123': fakeCoreWallet },
currencyConfig: { bitcoin: fakeCurrencyConfig },
watch() {}
}
}
}

const actual = renderer.render(<SwapSuccessSceneComponent {...fakeSceneProps('swapSuccess', {})} userId="" disklet={fakeDisklet} theme={getTheme()} />)
const renderer = TestRenderer.create(
<FakeProviders initialState={fakeState}>
<SwapSuccessScene {...fakeSceneProps('swapSuccess', {})} />
</FakeProviders>
)

expect(actual).toMatchSnapshot()
expect(renderer.toJSON()).toMatchSnapshot()
renderer.unmount()
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ exports[`CreateWalletImportScene should render with loading props 1`] = `
"paddingRight": 0,
"paddingTop": 64,
},
{
"maxHeight": 1334,
},
{
"padding": 0,
},
Expand Down Expand Up @@ -236,80 +233,100 @@ exports[`CreateWalletImportScene should render with loading props 1`] = `
</BVLinearGradient>
<View
style={
[
{
"justifyContent": "center",
"marginHorizontal": 22,
"paddingBottom": 22,
},
{
"marginTop": 22,
},
undefined,
]
{
"flexShrink": 1,
"margin": 11,
}
}
>
<View
style={
{
"alignItems": "center",
"flexDirection": "row",
"justifyContent": "space-between",
"justifyContent": "center",
"marginHorizontal": 11,
"overflow": "visible",
"paddingBottom": 22,
}
}
>
<Text
adjustsFontSizeToFit={true}
minimumFontScale={0.65}
numberOfLines={1}
<View
style={
{
"alignItems": "center",
"flexDirection": "row",
"justifyContent": "space-between",
}
}
>
<Text
adjustsFontSizeToFit={true}
minimumFontScale={0.65}
numberOfLines={1}
style={
[
{
"color": "#FFFFFF",
"fontFamily": "Quicksand-Regular",
"fontSize": 22,
"includeFontPadding": false,
},
{
"fontFamily": "Quicksand-Medium",
"fontSize": 27,
},
null,
]
}
>
Import Wallet
</Text>
</View>
<BVLinearGradient
colors={
[
{
"color": "#FFFFFF",
"fontFamily": "Quicksand-Regular",
"fontSize": 22,
"includeFontPadding": false,
},
{
"fontFamily": "Quicksand-Medium",
"fontSize": 27,
},
null,
452984831,
452984831,
]
}
>
Import Wallet
</Text>
endPoint={
{
"x": 1,
"y": 0.5,
}
}
locations={null}
startPoint={
{
"x": 0,
"y": 0.5,
}
}
style={
{
"alignSelf": "stretch",
"height": 1,
"marginRight": -22,
"marginTop": 22,
}
}
/>
</View>
</View>
<View
style={
{
"flexDirection": "row",
"justifyContent": "center",
"marginVertical": 45,
}
}
>
<ImportKeySvg
accessibilityHint="Import Key"
color="#00f1a2"
height={36}
width={83}
/>
</View>
<View
style={
[
{
"margin": 11,
},
<View
style={
{
"flexGrow": 1,
},
]
}
>
"flexDirection": "row",
"justifyContent": "center",
"marginVertical": 45,
}
}
>
<ImportKeySvg
accessibilityHint="Import Key"
color="#00f1a2"
height={36}
width={83}
/>
</View>
<Text
adjustsFontSizeToFit={false}
numberOfLines={0}
Expand Down Expand Up @@ -548,11 +565,12 @@ exports[`CreateWalletImportScene should render with loading props 1`] = `
}
keyboardType="email-address"
multiline={true}
numberOfLines={20}
numberOfLines={10}
onBlur={[Function]}
onChangeText={[Function]}
onFocus={[Function]}
onSubmitEditing={[Function]}
returnKeyType="none"
scale={
{
"value": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1402,21 +1402,45 @@ exports[`SwapConfirmationScene should render with loading props 1`] = `
}
>
<Text
adjustsFontSizeToFit={true}
minimumFontScale={0.65}
numberOfLines={1}
style={
{
"color": "#3dd9f4",
"fontSize": 17,
}
[
{
"color": "#FFFFFF",
"fontFamily": "Quicksand-Regular",
"fontSize": 22,
"includeFontPadding": false,
},
{
"color": "#3dd9f4",
"fontSize": 17,
},
null,
]
}
>
Powered by
</Text>
<Text
adjustsFontSizeToFit={true}
minimumFontScale={0.65}
numberOfLines={1}
style={
{
"color": "#3dd9f4",
"fontSize": 17,
}
[
{
"color": "#FFFFFF",
"fontFamily": "Quicksand-Regular",
"fontSize": 22,
"includeFontPadding": false,
},
{
"color": "#3dd9f4",
"fontSize": 17,
},
null,
]
}
/>
</View>
Expand All @@ -1428,11 +1452,23 @@ exports[`SwapConfirmationScene should render with loading props 1`] = `
}
>
<Text
adjustsFontSizeToFit={true}
minimumFontScale={0.65}
numberOfLines={1}
style={
{
"color": "#888888",
"fontSize": 17,
}
[
{
"color": "#FFFFFF",
"fontFamily": "Quicksand-Regular",
"fontSize": 22,
"includeFontPadding": false,
},
{
"color": "#888888",
"fontSize": 17,
},
null,
]
}
>
Tap to Change Provider
Expand Down
Loading
Loading