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

Fix dimensions #4031

Open
wants to merge 7 commits into
base: develop
Choose a base branch
from
Open
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
3 changes: 3 additions & 0 deletions jestSetup.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { jest } from '@jest/globals'
import mockSafeAreaContext from 'react-native-safe-area-context/jest/mock'

jest.useFakeTimers()

Expand Down Expand Up @@ -81,6 +82,8 @@ jest.mock('edge-login-ui-rn', () => ({
}
}))

jest.mock('react-native-safe-area-context', () => mockSafeAreaContext)

jest.mock('react-native-share', () => 'RNShare')

jest.mock(
Expand Down
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@
"process-nextick-args": "2.0.0",
"randombytes": "2.1.0",
"react-native-material-textfield": "0.16.1",
"react-native-safe-area-view": "0.14.9",
"regenerator-runtime": "0.13.2",
"ripemd160": "2.0.2",
"ripple-binary-codec": "0.2.3",
Expand Down Expand Up @@ -137,7 +136,6 @@
"react-native-contacts": "^7.0.4",
"react-native-custom-tabs": "https:/adminphoeniixx/react-native-custom-tabs#develop",
"react-native-device-info": "^8.7.1",
"react-native-extra-dimensions-android": "^1.2.5",
"react-native-fast-image": "^8.5.11",
"react-native-flipper": "^0.143.0",
"react-native-fs": "^2.19.0",
Expand All @@ -157,7 +155,6 @@
"react-native-reanimated": "^2.8.0",
"react-native-safari-view": "^2.1.0",
"react-native-safe-area-context": "^4.5.0",
"react-native-safe-area-view": "0.14.9",
"react-native-screens": "^3.19.0",
"react-native-share": "^7.1.2",
"react-native-smart-splash-screen": "^2.3.5",
Expand Down Expand Up @@ -200,7 +197,6 @@
"@types/prompts": "^2.0.14",
"@types/react-native": "0.67.1",
"@types/react-native-custom-tabs": "^0.1.2",
"@types/react-native-extra-dimensions-android": "^1.2.0",
"@types/react-native-material-textfield": "^0.16.5",
"@types/react-native-safari-view": "^2.0.5",
"@types/react-native-vector-icons": "^6.4.12",
Expand Down
70 changes: 0 additions & 70 deletions patches/react-native-safe-area-view+0.14.9.patch

This file was deleted.

11 changes: 4 additions & 7 deletions src/__tests__/components/BuyCrypto.test.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import { describe, expect, it } from '@jest/globals'
import * as React from 'react'
import { Provider } from 'react-redux'
import renderer from 'react-test-renderer'
import { createStore } from 'redux'

import { BuyCrypto } from '../../components/themed/BuyCrypto'
import { rootReducer } from '../../reducers/RootReducer'
import { fakeNavigation } from '../../util/fake/fakeNavigation'
import { FakeProviders, FakeState } from '../../util/fake/FakeProviders'

describe('BuyCrypto', () => {
const mockState: any = {
const mockState: FakeState = {
ui: {
settings: {
defaultIsoFiat: 'iso:DOLLA'
}
}
}
const store = createStore(rootReducer, mockState)

it('should render with some props', () => {
const fakeWallet: any = {
Expand All @@ -25,9 +22,9 @@ describe('BuyCrypto', () => {
}

const actual = renderer.create(
<Provider store={store}>
<FakeProviders initialState={mockState}>
<BuyCrypto wallet={fakeWallet} tokenId={undefined} navigation={fakeNavigation} />
</Provider>
</FakeProviders>
)

expect(actual).toMatchSnapshot()
Expand Down
11 changes: 4 additions & 7 deletions src/__tests__/components/CreateWalletSelectCryptoRow.test.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { describe, expect, it } from '@jest/globals'
import * as React from 'react'
import IonIcon from 'react-native-vector-icons/Ionicons'
import { Provider } from 'react-redux'
import TestRenderer from 'react-test-renderer'
import { createStore } from 'redux'

import { CreateWalletSelectCryptoRow } from '../../components/themed/CreateWalletSelectCryptoRow'
import { rootReducer } from '../../reducers/RootReducer'
import { FakeProviders, FakeState } from '../../util/fake/FakeProviders'

describe('WalletListRow', () => {
const mockState: any = {
const mockState: FakeState = {
core: {
account: {
currencyConfig: {
Expand All @@ -23,7 +21,6 @@ describe('WalletListRow', () => {
}
}
}
const store = createStore(rootReducer, mockState)

it('should render with loading props', () => {
const pluginId = 'bitcoin'
Expand All @@ -32,9 +29,9 @@ describe('WalletListRow', () => {
const rightSide = <IonIcon size={26} color="#66EDA8" name="chevron-forward-outline" />

const renderer = TestRenderer.create(
<Provider store={store}>
<FakeProviders initialState={mockState}>
<CreateWalletSelectCryptoRow pluginId={pluginId} walletName={walletName} onPress={onPress} rightSide={rightSide} />
</Provider>
</FakeProviders>
)

expect(renderer.toJSON()).toMatchSnapshot()
Expand Down
12 changes: 4 additions & 8 deletions src/__tests__/components/CurrencyIcon.test.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,28 @@
import { describe, expect, it } from '@jest/globals'
import * as React from 'react'
import { Provider } from 'react-redux'
import TestRenderer from 'react-test-renderer'
import { createStore } from 'redux'

import { CryptoIcon } from '../../components/icons/CryptoIcon'
import { rootReducer } from '../../reducers/RootReducer'
import { FakeProviders, FakeState } from '../../util/fake/FakeProviders'

describe('CryptoIcon', () => {
const mockState: any = {
const mockState: FakeState = {
core: {
account: {
currencyWallets: {
'332s0ds39f': {
pluginId: 'bitcoin',
watch: () => {}
}
}
}
}
}
const store = createStore(rootReducer, mockState)

it('should render with loading props', () => {
const renderer = TestRenderer.create(
<Provider store={store}>
<FakeProviders initialState={mockState}>
<CryptoIcon pluginId="bitcoin" tokenId="bitcoin" walletId="332s0ds39f" marginRem={1} />
</Provider>
</FakeProviders>
)

expect(renderer.toJSON()).toMatchSnapshot()
Expand Down
22 changes: 13 additions & 9 deletions src/__tests__/components/MenuTabs.test.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { describe, expect, it } from '@jest/globals'
import { BottomTabBarProps } from '@react-navigation/bottom-tabs'
import * as React from 'react'
import { createRenderer } from 'react-test-renderer/shallow'
import TestRenderer from 'react-test-renderer'

import { MenuTabs } from '../../components/themed/MenuTabs'
import { fakeNavigation } from '../../util/fake/fakeNavigation'
import { FakeProviders } from '../../util/fake/FakeProviders'

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

const props: BottomTabBarProps = { navigation: fakeNavigation, state: { index: 0, routes: [] } } as any

const actual = renderer.render(<MenuTabs {...props} />)

expect(actual).toMatchSnapshot()
const renderer = TestRenderer.create(
<FakeProviders>
<MenuTabs
// @ts-expect-error
navigation={fakeNavigation}
// @ts-expect-error
state={{ index: 0, routes: [] }}
/>
</FakeProviders>
)
expect(renderer.toJSON()).toMatchSnapshot()
})
})
13 changes: 5 additions & 8 deletions src/__tests__/components/PromoCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { describe, expect, it } from '@jest/globals'
import * as React from 'react'
import { Provider } from 'react-redux'
import renderer from 'react-test-renderer'
import { createStore } from 'redux'

import { PromoCard } from '../../components/cards/PromoCard'
import { rootReducer } from '../../reducers/RootReducer'
import { MessageTweak } from '../../types/TweakTypes'
import { fakeNavigation } from '../../util/fake/fakeNavigation'
import { FakeProviders, FakeState } from '../../util/fake/FakeProviders'

describe('PromoCard', () => {
const fakeMessage: MessageTweak = {
Expand All @@ -16,27 +14,26 @@ describe('PromoCard', () => {
durationDays: 1
}

const mockState: any = {
const mockState: FakeState = {
account: {
accountReferral: {
installerId: 'string',
currencyCodes: ['BTC'],
promotions: [],
ignoreAccountSwap: true,
hiddenAccountMessages: ['messageId']
hiddenAccountMessages: { messageId: true }
},
referralCache: {
accountMessages: [fakeMessage]
}
}
}
const store = createStore(rootReducer, mockState)

it('should render', () => {
const actual = renderer.create(
<Provider store={store}>
<FakeProviders initialState={mockState}>
<PromoCard navigation={fakeNavigation} />
</Provider>
</FakeProviders>
)

expect(actual).toMatchSnapshot()
Expand Down
13 changes: 5 additions & 8 deletions src/__tests__/components/TransactionListRow.test.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { describe, expect, it } from '@jest/globals'
import * as React from 'react'
import { Provider } from 'react-redux'
import TestRenderer from 'react-test-renderer'
import { createStore } from 'redux'

import { TransactionListRow } from '../../components/themed/TransactionListRow'
import { rootReducer } from '../../reducers/RootReducer'
import { fakeNavigation } from '../../util/fake/fakeNavigation'
import { FakeProviders, FakeState } from '../../util/fake/FakeProviders'

describe('TransactionListRow', () => {
it('should render with loading props', () => {
Expand All @@ -30,22 +28,21 @@ describe('TransactionListRow', () => {
fiatCurrencyCode: 'iso:USD'
}

const mockStore: any = {
const mockStore: FakeState = {
core: {
account: {
currencyConfig: {
bitcoin: {
allTokens: [],
allTokens: {},
currencyInfo
}
}
}
}
}
const store = createStore(rootReducer, mockStore)

const renderer = TestRenderer.create(
<Provider store={store}>
<FakeProviders initialState={mockStore}>
<TransactionListRow
navigation={fakeNavigation}
wallet={fakeWallet}
Expand All @@ -65,7 +62,7 @@ describe('TransactionListRow', () => {
ourReceiveAddresses: []
}}
/>
</Provider>
</FakeProviders>
)

expect(renderer.toJSON()).toMatchSnapshot()
Expand Down
Loading