From 2afed09722ab95c0caa5c519b2b07d6e53c78429 Mon Sep 17 00:00:00 2001 From: JC Date: Mon, 20 Apr 2026 09:05:35 -0600 Subject: [PATCH 001/393] fix: prettier format globally applied --- .detoxrc.js | 103 +- App.tsx | 16 +- .../@react-native-clipboard/clipboard.js | 4 +- __mocks__/@react-native-community/netinfo.js | 38 +- .../netinfo/src/index.js | 38 +- __mocks__/@react-navigation/drawer.js | 14 +- __mocks__/@react-navigation/elements.js | 4 +- __mocks__/@react-navigation/native.js | 4 +- __mocks__/dataMocks/mockAddresses.ts | 83 +- .../dataMocks/mockLoadedAppNavigation.ts | 5 +- __mocks__/dataMocks/mockLoadedAppRoute.ts | 5 +- .../dataMocks/mockLoadingAppNavigation.ts | 5 +- __mocks__/dataMocks/mockLoadingAppRoute.ts | 5 +- __mocks__/dataMocks/mockSendPageState.ts | 7 +- __mocks__/dataMocks/mockTranslate.ts | 6 +- __mocks__/dataMocks/mockValueTransfers.ts | 6 +- __mocks__/i18n-js.js | 8 +- __mocks__/moment.js | 2 +- __mocks__/moment/locale/es.js | 2 +- __mocks__/moment/locale/pt.js | 2 +- __mocks__/moment/locale/ru.js | 2 +- __mocks__/react-native-easy-biometrics.js | 2 +- __mocks__/react-native-gesture-handler.js | 24 +- __mocks__/react-native-keychain.js | 14 +- __mocks__/react-native-localize.js | 8 +- __mocks__/react-native-reanimated.js | 6 +- __mocks__/react-native.js | 8 +- __tests__/About.snapshot.tsx | 10 +- __tests__/AddressBook.AbDetail.snapshot.tsx | 12 +- __tests__/AddressBook.snapshot.tsx | 10 +- __tests__/AddressList.snapshot.tsx | 9 +- __tests__/Button.snapshot.tsx | 8 +- __tests__/ChainTypeToggle.snapshot.tsx | 6 +- __tests__/Components.snapshot.tsx | 22 +- __tests__/Components.unit.tsx | 103 +- __tests__/DetailLine.snapshot.tsx | 12 +- __tests__/Drawer.snapshot.tsx | 6 +- __tests__/Header.snapshot.tsx | 5 +- .../History.ValueTransferDetail.unit.tsx | 9 +- __tests__/History.snapshot.tsx | 16 +- __tests__/ImportUfvk.snapshot.tsx | 5 +- __tests__/Info.es.unit.tsx | 10 +- __tests__/Info.snapshot.tsx | 10 +- __tests__/Info.us.unit.tsx | 10 +- __tests__/Insight.snapshot.tsx | 10 +- __tests__/LoadedApp.snapshot.tsx | 7 +- __tests__/LoadingApp.snapshot.tsx | 7 +- __tests__/Memo.snapshot.tsx | 10 +- __tests__/Pools.snapshot.tsx | 10 +- __tests__/PriceFetcher.snapshot.tsx | 8 +- __tests__/Receive.snapshot.tsx | 19 +- __tests__/Rescan.snapshot.tsx | 10 +- __tests__/Scanner.snapshot.tsx | 4 +- __tests__/Seed.snapshot.tsx | 4 +- __tests__/Send.snapshot.tsx | 16 +- __tests__/Settings.snapshot.tsx | 20 +- __tests__/ShowUfvk.snapshot.tsx | 9 +- __tests__/SingleAddress.snapshot.tsx | 18 +- __tests__/SyncReport.snapshot.tsx | 10 +- app/AppState/AppStateLoaded.ts | 2 - app/AppState/AppStateLoading.ts | 2 - .../classes/TransparentAddressClass.ts | 7 +- app/AppState/classes/UnifiedAddressClass.ts | 9 +- app/AppState/types/ContactType.ts | 2 - app/AppState/types/InfoType.ts | 1 - app/AppState/types/NetInfoType.ts | 1 - app/AppState/types/SecurityType.ts | 2 - app/AppState/types/SendJsonToTypeType.ts | 1 - app/AppState/types/ServerType.ts | 2 - app/AppState/types/ServerUrisType.ts | 2 - app/AppState/types/SnackbarType.ts | 2 - app/AppState/types/TransactionType.ts | 1 - app/AppState/types/TxDetailType.ts | 1 - app/AppState/types/ValueTransferType.ts | 1 - app/AppState/types/WalletType.ts | 2 - app/AppState/types/ZecPriceType.ts | 2 - app/LoadedApp/LoadedApp.tsx | 1356 +++++++++++------ .../components/ComputingTxContent.tsx | 21 +- app/LoadingApp/LoadingApp.tsx | 665 +++++--- app/LoadingApp/components/ImportUfvk.tsx | 153 +- app/LoadingApp/components/Launching.tsx | 122 +- app/LoadingApp/components/NewSeed.tsx | 87 +- app/LoadingApp/components/ScannerUfvk.tsx | 10 +- app/LoadingApp/components/StartMenu.tsx | 257 +++- app/context/contextAppLoaded.tsx | 11 +- app/context/contextAppLoading.tsx | 11 +- app/context/index.js | 12 +- app/createAlert.ts | 22 +- app/recoveryWalletInfov10.ts | 76 +- app/rpc/RPC.ts | 556 ++++--- app/rpc/types/RPCSyncCompletePollType.ts | 13 +- app/rpc/types/RPCSyncPollType.ts | 2 +- app/rpc/types/RPCSyncScanRangeStatusType.ts | 6 +- app/rpc/types/RPCSyncStatusType.ts | 24 +- app/selectingServer.ts | 13 +- app/sendEmail.ts | 9 +- app/simpleBiometrics.ts | 11 +- app/types/NavigationTypes.ts | 16 +- app/types/index.js | 16 +- app/uris/checkServerURI.ts | 30 +- app/uris/index.js | 8 +- app/uris/parseServerURI.ts | 18 +- app/uris/parseZcashURI.ts | 33 +- app/uris/serverUris.ts | 4 +- app/utils/Utils.ts | 109 +- components/About/About.tsx | 25 +- components/AddressBook/AddressBook.tsx | 289 ++-- components/AddressBook/AddressBookFileImpl.ts | 29 +- .../AddressBook/components/AbDetail.tsx | 73 +- .../AddressBook/components/AbSummaryLine.tsx | 129 +- components/AddressList/AddressList.tsx | 140 +- .../AddressList/components/AlSummaryLine.tsx | 77 +- components/Background/BackgroundFileImpl.ts | 9 +- components/Components/Address/Address.tsx | 2 +- components/Components/AddressItem.tsx | 108 +- components/Components/BoldText.tsx | 7 +- components/Components/Button.tsx | 85 +- components/Components/ChainTypeToggle.tsx | 87 +- components/Components/CircularProgress.tsx | 9 +- components/Components/CurrencyAmount.tsx | 32 +- components/Components/DetailLine.tsx | 13 +- components/Components/ErrorText.tsx | 13 +- components/Components/FadeText.tsx | 3 +- components/Components/Icons/FiltersIcon.tsx | 6 +- components/Components/Icons/Icon.tsx | 11 +- components/Components/PriceFetcher.tsx | 90 +- components/Components/RegText.tsx | 24 +- components/Components/SingleAddress.tsx | 296 ++-- components/Components/Snackbars.tsx | 29 +- components/Components/TextInputAddress.tsx | 57 +- components/Components/ZecAmount.tsx | 30 +- components/Drawer/Drawer.tsx | 23 +- components/Drawer/components/Menu.tsx | 205 ++- components/Header/Header.tsx | 496 ++++-- components/History/History.tsx | 255 +++- components/History/components/Filters.tsx | 207 ++- .../components/ValueTransferDetail.tsx | 673 ++++++-- .../History/components/ValueTransferLine.tsx | 345 +++-- components/Info/Info.tsx | 94 +- components/Insight/Insight.tsx | 205 ++- components/Memo/Memo.tsx | 118 +- components/Messages/MessagesAddress.tsx | 16 +- components/Messages/MessagesAll.tsx | 18 +- .../Messages/components/ContactLine.tsx | 221 ++- .../Messages/components/ContactList.tsx | 286 +++- .../Messages/components/MessageLine.tsx | 194 ++- .../Messages/components/MessageList.tsx | 551 ++++--- components/Pools/Pools.tsx | 169 +- components/Receive/Receive.tsx | 169 +- .../Receive/components/ExpandedAddress.tsx | 35 +- components/Receive/components/NewAddress.tsx | 140 +- .../Receive/components/NewAddressTag.tsx | 50 +- .../Receive/components/TransparentWarning.tsx | 43 +- .../Receive/components/VerifyAddress.tsx | 74 +- components/Rescan/Rescan.tsx | 56 +- components/Scanner/Scanner.android.tsx | 6 +- components/Scanner/Scanner.ios.tsx | 30 +- components/Seed/Seed.tsx | 133 +- components/Send/Send.tsx | 1018 +++++++++---- components/Send/components/Confirm.tsx | 274 +++- components/Send/components/ScannerAddress.tsx | 39 +- .../Send/components/ShowAddressAlertAsync.ts | 4 +- components/Settings/Settings.tsx | 561 +++++-- components/Settings/SettingsFileImpl.ts | 55 +- components/SyncReport/SyncReport.tsx | 402 +++-- components/Ufvk/ShowUfvk.tsx | 171 ++- e2e/change_custom_regtest_server.test.js | 68 +- e2e/change_custom_server.test.js | 70 +- e2e/change_custom_testnet_server.test.js | 68 +- e2e/change_server_from_list.test.js | 58 +- e2e/e2e-utils/loadRecipientWallet.js | 98 +- e2e/e2e-utils/loadTestWallet.js | 38 +- e2e/parse_invalid_address.test.js | 8 +- e2e/reload_while_tx_pending.test.js | 154 +- e2e/screen_awake.test.js | 72 +- e2e/send.test.js | 4 +- e2e/sync_report.test.js | 61 +- e2e/tex_send_address.test.js | 4 +- e2e/transaction_history.test.js | 14 +- package.json | 1 + 180 files changed, 10063 insertions(+), 4221 deletions(-) diff --git a/.detoxrc.js b/.detoxrc.js index aeb24fa563..bb2e754737 100644 --- a/.detoxrc.js +++ b/.detoxrc.js @@ -2,146 +2,145 @@ module.exports = { testRunner: { args: { - '$0': 'jest', + $0: 'jest', config: 'e2e/e2e-utils/jest.config.js', - "testTimeout": 1800000, + testTimeout: 1800000, }, jest: { - setupTimeout: 1800000 - } + setupTimeout: 1800000, + }, }, apps: { 'ios.debug': { type: 'ios.app', binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/Zingo.app', - build: "xcodebuild -workspace ios/Zingo.xcworkspace -scheme Zingo -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5'" + build: + "xcodebuild -workspace ios/Zingo.xcworkspace -scheme Zingo -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5'", }, 'ios.release': { type: 'ios.app', binaryPath: 'ios/build/Build/Products/Release-iphonesimulator/Zingo.app', - build: "xcodebuild -workspace ios/Zingo.xcworkspace -scheme Zingo -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5'" + build: + "xcodebuild -workspace ios/Zingo.xcworkspace -scheme Zingo -configuration Release -sdk iphonesimulator -derivedDataPath ios/build -destination 'platform=iOS Simulator,name=iPhone 16,OS=18.5'", }, 'android.debug': { type: 'android.apk', binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk', - build: 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', - reversePorts: [ - 8081 - ] + build: + 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', + reversePorts: [8081], }, 'android.debug.x86_64': { type: 'android.apk', binaryPath: 'android/app/build/outputs/apk/debug/app-x86_64-debug.apk', - build: 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', - reversePorts: [ - 8081 - ] + build: + 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', + reversePorts: [8081], }, 'android.debug.x86': { type: 'android.apk', binaryPath: 'android/app/build/outputs/apk/debug/app-x86-debug.apk', - build: 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', - reversePorts: [ - 8081 - ] + build: + 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', + reversePorts: [8081], }, 'android.debug.arm64-v8a': { type: 'android.apk', binaryPath: 'android/app/build/outputs/apk/debug/app-arm64-v8a-debug.apk', - build: 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', - reversePorts: [ - 8081 - ] + build: + 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', + reversePorts: [8081], }, 'android.debug.armeabi-v7a': { type: 'android.apk', - binaryPath: 'android/app/build/outputs/apk/debug/app-armeabi-v7a-debug.apk', - build: 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', - reversePorts: [ - 8081 - ] + binaryPath: + 'android/app/build/outputs/apk/debug/app-armeabi-v7a-debug.apk', + build: + 'cd android ; ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug ; cd -', + reversePorts: [8081], }, 'android.release': { type: 'android.apk', binaryPath: 'android/app/build/outputs/apk/release/app-release.apk', - build: 'cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -' - } + build: + 'cd android ; ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release ; cd -', + }, }, devices: { simulator: { type: 'ios.simulator', device: { type: 'iPhone 16', - os: 'iOS 18.5' - } + os: 'iOS 18.5', + }, }, attached: { type: 'android.attached', device: { - adbName: '.*' - } + adbName: '.*', + }, }, emulator_x86_64: { type: 'android.emulator', device: { - avdName: 'android-30_google_apis_playstore_x86_64' - } + avdName: 'android-30_google_apis_playstore_x86_64', + }, }, emulator_x86: { type: 'android.emulator', device: { - avdName: 'android-30_google_apis_playstore_x86' - } - } + avdName: 'android-30_google_apis_playstore_x86', + }, + }, }, configurations: { 'ios.sim.debug': { device: 'simulator', - app: 'ios.debug' + app: 'ios.debug', }, 'ios.sim.release': { device: 'simulator', - app: 'ios.release' + app: 'ios.release', }, 'android.att.debug': { device: 'attached', - app: 'android.debug' + app: 'android.debug', }, 'android.att.debug.x86_64': { device: 'attached', - app: 'android.debug.x86_64' + app: 'android.debug.x86_64', }, 'android.att.debug.x86': { device: 'attached', - app: 'android.debug.x86' + app: 'android.debug.x86', }, 'android.att.debug.arm64-v8a': { device: 'attached', - app: 'android.debug.arm64-v8a' + app: 'android.debug.arm64-v8a', }, 'android.att.debug.armeabi-v7a': { device: 'attached', - app: 'android.debug.armeabi-v7a' + app: 'android.debug.armeabi-v7a', }, 'android.att.release': { device: 'attached', - app: 'android.release' + app: 'android.release', }, 'android.emu.debug': { device: 'emulator_x86', - app: 'android.debug' + app: 'android.debug', }, 'android.emu.release': { device: 'emulator_x86', - app: 'android.release' + app: 'android.release', }, 'android.emu.x86_64': { device: 'emulator_x86_64', - app: 'android.debug' + app: 'android.debug', }, 'android.emu.x86': { device: 'emulator_x86', - app: 'android.debug' + app: 'android.debug', }, - } -}; \ No newline at end of file + }, +}; diff --git a/App.tsx b/App.tsx index 46c71e3067..7c6d728639 100644 --- a/App.tsx +++ b/App.tsx @@ -1,7 +1,11 @@ /* eslint-disable react-native/no-inline-styles */ import React, { useEffect, useState } from 'react'; import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context'; -import { createNavigationContainerRef, DefaultTheme, NavigationContainer } from '@react-navigation/native'; +import { + createNavigationContainerRef, + DefaultTheme, + NavigationContainer, +} from '@react-navigation/native'; import { createStackNavigator } from '@react-navigation/stack'; import { LoadedApp } from './app/LoadedApp'; @@ -11,7 +15,9 @@ import { ModeEnum, RouteEnum } from './app/AppState'; import { BackHandler, LogBox, StatusBar } from 'react-native'; -LogBox.ignoreLogs(['[Reanimated] Reduced motion setting is enabled on this device.']); +LogBox.ignoreLogs([ + '[Reanimated] Reduced motion setting is enabled on this device.', +]); const advancePalette: string[] = [ '#06172d', @@ -146,10 +152,12 @@ const App: React.FunctionComponent = () => { style={{ flex: 1, backgroundColor: theme.colors.background, - }}> + }} + > + screenOptions={{ headerShown: false, animation: 'none' }} + > {props => } diff --git a/__mocks__/@react-native-clipboard/clipboard.js b/__mocks__/@react-native-clipboard/clipboard.js index d56718fa13..c81b1f8e11 100644 --- a/__mocks__/@react-native-clipboard/clipboard.js +++ b/__mocks__/@react-native-clipboard/clipboard.js @@ -1,2 +1,4 @@ -export const getString = jest.fn(() => Promise.resolve('mocked clipboard content')); +export const getString = jest.fn(() => + Promise.resolve('mocked clipboard content'), +); export const setString = jest.fn(); diff --git a/__mocks__/@react-native-community/netinfo.js b/__mocks__/@react-native-community/netinfo.js index f833bee3a8..9afed6b1bd 100644 --- a/__mocks__/@react-native-community/netinfo.js +++ b/__mocks__/@react-native-community/netinfo.js @@ -1,28 +1,28 @@ const RN = jest.requireActual('react-native'); export const NetInfoStateType = { - unknown: 'unknown', - none: 'none', - cellular: 'cellular', - wifi: 'wifi', - bluetooth: 'bluetooth', - ethernet: 'ethernet', - wimax: 'wimax', - vpn: 'vpn', - other: 'other', - }; + unknown: 'unknown', + none: 'none', + cellular: 'cellular', + wifi: 'wifi', + bluetooth: 'bluetooth', + ethernet: 'ethernet', + wimax: 'wimax', + vpn: 'vpn', + other: 'other', +}; RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), + execute: jest.fn(() => '{}'), }; export default { - RNCNetInfo: RN, - addEventListener: jest.fn(), - fetch: jest.fn().mockImplementation(() => - Promise.resolve({ - isConnected: true, - isInternetReachable: true, - }), - ), + RNCNetInfo: RN, + addEventListener: jest.fn(), + fetch: jest.fn().mockImplementation(() => + Promise.resolve({ + isConnected: true, + isInternetReachable: true, + }), + ), }; diff --git a/__mocks__/@react-native-community/netinfo/src/index.js b/__mocks__/@react-native-community/netinfo/src/index.js index f833bee3a8..9afed6b1bd 100644 --- a/__mocks__/@react-native-community/netinfo/src/index.js +++ b/__mocks__/@react-native-community/netinfo/src/index.js @@ -1,28 +1,28 @@ const RN = jest.requireActual('react-native'); export const NetInfoStateType = { - unknown: 'unknown', - none: 'none', - cellular: 'cellular', - wifi: 'wifi', - bluetooth: 'bluetooth', - ethernet: 'ethernet', - wimax: 'wimax', - vpn: 'vpn', - other: 'other', - }; + unknown: 'unknown', + none: 'none', + cellular: 'cellular', + wifi: 'wifi', + bluetooth: 'bluetooth', + ethernet: 'ethernet', + wimax: 'wimax', + vpn: 'vpn', + other: 'other', +}; RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), + execute: jest.fn(() => '{}'), }; export default { - RNCNetInfo: RN, - addEventListener: jest.fn(), - fetch: jest.fn().mockImplementation(() => - Promise.resolve({ - isConnected: true, - isInternetReachable: true, - }), - ), + RNCNetInfo: RN, + addEventListener: jest.fn(), + fetch: jest.fn().mockImplementation(() => + Promise.resolve({ + isConnected: true, + isInternetReachable: true, + }), + ), }; diff --git a/__mocks__/@react-navigation/drawer.js b/__mocks__/@react-navigation/drawer.js index bf02f46cc1..01ce0ea084 100644 --- a/__mocks__/@react-navigation/drawer.js +++ b/__mocks__/@react-navigation/drawer.js @@ -27,15 +27,15 @@ const mockNavigation = { }; const MockNavigator = ({ children }) => children; const MockScreen = ({ _name, children, component }) => { - if (typeof children === 'function') { - return children({ navigation: mockNavigation }); - } + if (typeof children === 'function') { + return children({ navigation: mockNavigation }); + } - const Component = component; - return Component ? : <>{children}; + const Component = component; + return Component ? : <>{children}; }; export const createDrawerNavigator = jest.fn(() => ({ - Navigator: MockNavigator, - Screen: MockScreen, + Navigator: MockNavigator, + Screen: MockScreen, })); diff --git a/__mocks__/@react-navigation/elements.js b/__mocks__/@react-navigation/elements.js index 8ec3deaa8e..b040e7173b 100644 --- a/__mocks__/@react-navigation/elements.js +++ b/__mocks__/@react-navigation/elements.js @@ -1 +1,3 @@ -export const PlatformPressable = jest.fn().mockImplementation(({ children }) => children); +export const PlatformPressable = jest + .fn() + .mockImplementation(({ children }) => children); diff --git a/__mocks__/@react-navigation/native.js b/__mocks__/@react-navigation/native.js index 4ad79b30f0..65ac1a7711 100644 --- a/__mocks__/@react-navigation/native.js +++ b/__mocks__/@react-navigation/native.js @@ -1,6 +1,6 @@ import { mockTheme } from '../dataMocks/mockTheme'; -export const useTheme = () => (mockTheme); +export const useTheme = () => mockTheme; export const useScrollToTop = jest.fn(); export const useIsFocused = jest.fn(); export const useNavigation = jest.fn(); @@ -37,4 +37,4 @@ export const createNavigationContainerRef = jest.fn(() => { refImpl.current = refImpl; return refImpl; -}); \ No newline at end of file +}); diff --git a/__mocks__/dataMocks/mockAddresses.ts b/__mocks__/dataMocks/mockAddresses.ts index 4b9ee7fdeb..eb6de1d0c1 100644 --- a/__mocks__/dataMocks/mockAddresses.ts +++ b/__mocks__/dataMocks/mockAddresses.ts @@ -1,41 +1,46 @@ -import { UnifiedAddressClass, AddressKindEnum, TransparentAddressClass } from '../../app/AppState'; +import { + UnifiedAddressClass, + AddressKindEnum, + TransparentAddressClass, +} from '../../app/AppState'; import { RPCAddressScopeEnum } from '../../app/rpc/enums/RPCAddressScopeEnum'; -export const mockAddresses: (UnifiedAddressClass | TransparentAddressClass)[] = [ - { - index: 0, - address: 'UA-orchard-sapling12345678901234567890', - addressKind: AddressKindEnum.u, - has_orchard: true, - has_sapling: true, - has_transparent: false, - }, - { - index: 1, - address: 'UA-sapling-12345678901234567890', - addressKind: AddressKindEnum.u, - has_orchard: false, - has_sapling: true, - has_transparent: false, - }, - { - index: 2, - address: 'UA-orchard-12345678901234567890', - addressKind: AddressKindEnum.u, - has_orchard: true, - has_sapling: false, - has_transparent: false, - }, - { - index: 0, - address: 'transparent-1-12345678901234567890', - addressKind: AddressKindEnum.t, - scope: RPCAddressScopeEnum.external, - }, - { - index: 1, - address: 'transparent-2-12345678901234567890', - addressKind: AddressKindEnum.t, - scope: RPCAddressScopeEnum.external, - }, -]; +export const mockAddresses: (UnifiedAddressClass | TransparentAddressClass)[] = + [ + { + index: 0, + address: 'UA-orchard-sapling12345678901234567890', + addressKind: AddressKindEnum.u, + has_orchard: true, + has_sapling: true, + has_transparent: false, + }, + { + index: 1, + address: 'UA-sapling-12345678901234567890', + addressKind: AddressKindEnum.u, + has_orchard: false, + has_sapling: true, + has_transparent: false, + }, + { + index: 2, + address: 'UA-orchard-12345678901234567890', + addressKind: AddressKindEnum.u, + has_orchard: true, + has_sapling: false, + has_transparent: false, + }, + { + index: 0, + address: 'transparent-1-12345678901234567890', + addressKind: AddressKindEnum.t, + scope: RPCAddressScopeEnum.external, + }, + { + index: 1, + address: 'transparent-2-12345678901234567890', + addressKind: AddressKindEnum.t, + scope: RPCAddressScopeEnum.external, + }, + ]; diff --git a/__mocks__/dataMocks/mockLoadedAppNavigation.ts b/__mocks__/dataMocks/mockLoadedAppNavigation.ts index 083c49f3e2..6df8dac0e4 100644 --- a/__mocks__/dataMocks/mockLoadedAppNavigation.ts +++ b/__mocks__/dataMocks/mockLoadedAppNavigation.ts @@ -2,7 +2,10 @@ import { StackNavigationProp } from '@react-navigation/stack'; import { AppStackParamList } from '../../app/types'; import { RouteEnum } from '../../app/AppState'; -export const mockLoadedAppNavigation: StackNavigationProp = { +export const mockLoadedAppNavigation: StackNavigationProp< + AppStackParamList, + RouteEnum.LoadedApp +> = { navigate: jest.fn(), goBack: jest.fn(), dispatch: jest.fn(), diff --git a/__mocks__/dataMocks/mockLoadedAppRoute.ts b/__mocks__/dataMocks/mockLoadedAppRoute.ts index 952a5d76fd..738803ee60 100644 --- a/__mocks__/dataMocks/mockLoadedAppRoute.ts +++ b/__mocks__/dataMocks/mockLoadedAppRoute.ts @@ -2,7 +2,10 @@ import { RouteProp } from '@react-navigation/native'; import { AppStackParamList } from '../../app/types'; import { LaunchingModeEnum, RouteEnum } from '../../app/AppState'; -export const mockLoadedAppRoute: RouteProp = { +export const mockLoadedAppRoute: RouteProp< + AppStackParamList, + RouteEnum.LoadedApp +> = { key: 'LoadedApp-test', name: RouteEnum.LoadedApp, params: { diff --git a/__mocks__/dataMocks/mockLoadingAppNavigation.ts b/__mocks__/dataMocks/mockLoadingAppNavigation.ts index dbaa8ed85d..4eb7deb2ab 100644 --- a/__mocks__/dataMocks/mockLoadingAppNavigation.ts +++ b/__mocks__/dataMocks/mockLoadingAppNavigation.ts @@ -2,7 +2,10 @@ import { StackNavigationProp } from '@react-navigation/stack'; import { AppStackParamList } from '../../app/types'; import { RouteEnum } from '../../app/AppState'; -export const mockLoadingAppNavigation: StackNavigationProp = { +export const mockLoadingAppNavigation: StackNavigationProp< + AppStackParamList, + RouteEnum.LoadingApp +> = { navigate: jest.fn(), goBack: jest.fn(), dispatch: jest.fn(), diff --git a/__mocks__/dataMocks/mockLoadingAppRoute.ts b/__mocks__/dataMocks/mockLoadingAppRoute.ts index 4be399e06b..329fadc7f8 100644 --- a/__mocks__/dataMocks/mockLoadingAppRoute.ts +++ b/__mocks__/dataMocks/mockLoadingAppRoute.ts @@ -2,7 +2,10 @@ import { RouteProp } from '@react-navigation/native'; import { AppStackParamList } from '../../app/types'; import { RouteEnum } from '../../app/AppState'; -export const mockLoadingAppRoute: RouteProp = { +export const mockLoadingAppRoute: RouteProp< + AppStackParamList, + RouteEnum.LoadingApp +> = { key: 'LoadingApp-test', name: RouteEnum.LoadingApp, params: { diff --git a/__mocks__/dataMocks/mockSendPageState.ts b/__mocks__/dataMocks/mockSendPageState.ts index a3084b0d3f..4b277aa8d2 100644 --- a/__mocks__/dataMocks/mockSendPageState.ts +++ b/__mocks__/dataMocks/mockSendPageState.ts @@ -1,11 +1,14 @@ import { SendPageStateClass, ToAddrClass } from '../../app/AppState'; -const mockSendPageState: SendPageStateClass = new SendPageStateClass(new ToAddrClass(0)); +const mockSendPageState: SendPageStateClass = new SendPageStateClass( + new ToAddrClass(0), +); mockSendPageState.toaddr.id = 1234567890; mockSendPageState.toaddr.to = 'UA-12345678901234567890'; mockSendPageState.toaddr.amount = '1.12345678'; mockSendPageState.toaddr.amountCurrency = '50.22'; -mockSendPageState.toaddr.memo = 'memo1\nmemo2\nmemo3\nmemo4\nmemo5\nmemo6\nmemo7\nmemo8\nmemo9\nmemo10'; +mockSendPageState.toaddr.memo = + 'memo1\nmemo2\nmemo3\nmemo4\nmemo5\nmemo6\nmemo7\nmemo8\nmemo9\nmemo10'; export default mockSendPageState; diff --git a/__mocks__/dataMocks/mockTranslate.ts b/__mocks__/dataMocks/mockTranslate.ts index 60bcd6f1f0..72dca2a59b 100644 --- a/__mocks__/dataMocks/mockTranslate.ts +++ b/__mocks__/dataMocks/mockTranslate.ts @@ -1,4 +1,8 @@ -import { CurrencyEnum, LanguageEnum, BlockExplorerEnum } from '../../app/AppState'; +import { + CurrencyEnum, + LanguageEnum, + BlockExplorerEnum, +} from '../../app/AppState'; import { RPCPerformanceLevelEnum } from '../../app/rpc/enums/RPCPerformanceLevelEnum'; export const mockTranslate = (p: string) => { diff --git a/__mocks__/dataMocks/mockValueTransfers.ts b/__mocks__/dataMocks/mockValueTransfers.ts index d709f48cc6..9335d076b6 100644 --- a/__mocks__/dataMocks/mockValueTransfers.ts +++ b/__mocks__/dataMocks/mockValueTransfers.ts @@ -1,4 +1,8 @@ -import { PoolEnum, ValueTransferType, ValueTransferKindEnum } from '../../app/AppState'; +import { + PoolEnum, + ValueTransferType, + ValueTransferKindEnum, +} from '../../app/AppState'; import { RPCValueTransfersStatusEnum } from '../../app/rpc/enums/RPCValueTransfersStatusEnum'; export const mockValueTransfers: ValueTransferType[] = [ diff --git a/__mocks__/i18n-js.js b/__mocks__/i18n-js.js index c0411e8a20..5a466e2ee6 100644 --- a/__mocks__/i18n-js.js +++ b/__mocks__/i18n-js.js @@ -1,12 +1,12 @@ // i18n-js.js -const I18nCtor = jest.fn().mockImplementation((_file) => ({ - t: jest.fn((k) => k), +const I18nCtor = jest.fn().mockImplementation(_file => ({ + t: jest.fn(k => k), locale: 'en', })); module.exports = { __esModule: true, - I18n: I18nCtor, // soporte import nombrado - default: I18nCtor // soporte import por defecto + I18n: I18nCtor, // soporte import nombrado + default: I18nCtor, // soporte import por defecto }; diff --git a/__mocks__/moment.js b/__mocks__/moment.js index 253b719894..27a8a1111e 100644 --- a/__mocks__/moment.js +++ b/__mocks__/moment.js @@ -1,5 +1,5 @@ const mMoment = { - format: (p) => { + format: p => { if (p === 'MMM YYYY') { return 'Dec 2022'; } else if (p === 'YYYY MMM D h:mm a') { diff --git a/__mocks__/moment/locale/es.js b/__mocks__/moment/locale/es.js index 24ae07ecd3..540950b133 100644 --- a/__mocks__/moment/locale/es.js +++ b/__mocks__/moment/locale/es.js @@ -1,3 +1,3 @@ export default () => () => ({ - defineLocale: jest.fn(), + defineLocale: jest.fn(), }); diff --git a/__mocks__/moment/locale/pt.js b/__mocks__/moment/locale/pt.js index 24ae07ecd3..540950b133 100644 --- a/__mocks__/moment/locale/pt.js +++ b/__mocks__/moment/locale/pt.js @@ -1,3 +1,3 @@ export default () => () => ({ - defineLocale: jest.fn(), + defineLocale: jest.fn(), }); diff --git a/__mocks__/moment/locale/ru.js b/__mocks__/moment/locale/ru.js index 24ae07ecd3..540950b133 100644 --- a/__mocks__/moment/locale/ru.js +++ b/__mocks__/moment/locale/ru.js @@ -1,3 +1,3 @@ export default () => () => ({ - defineLocale: jest.fn(), + defineLocale: jest.fn(), }); diff --git a/__mocks__/react-native-easy-biometrics.js b/__mocks__/react-native-easy-biometrics.js index 334be98024..7e40fbe192 100644 --- a/__mocks__/react-native-easy-biometrics.js +++ b/__mocks__/react-native-easy-biometrics.js @@ -1,3 +1,3 @@ export const RNBiometrics = { - requestBioAuth: jest.fn(() => Promise.resolve(true)), + requestBioAuth: jest.fn(() => Promise.resolve(true)), }; diff --git a/__mocks__/react-native-gesture-handler.js b/__mocks__/react-native-gesture-handler.js index 5eeb5070d2..cd536cf3e5 100644 --- a/__mocks__/react-native-gesture-handler.js +++ b/__mocks__/react-native-gesture-handler.js @@ -1,16 +1,16 @@ export const GestureHandlerRootView = ({ children }) => children; export default { - Swipeable: jest.fn().mockImplementation(({ children }) => children), - RNGestureHandlerModule: { - attachGestureHandler: jest.fn(), - createGestureHandler: jest.fn(), - dropGestureHandler: jest.fn(), - updateGestureHandler: jest.fn(), - forceTouchAvailable: jest.fn(), - hasGenericPassword: jest.fn(), - getSupportedBiometryType: jest.fn(), - State: {}, - Directions: {}, - }, + Swipeable: jest.fn().mockImplementation(({ children }) => children), + RNGestureHandlerModule: { + attachGestureHandler: jest.fn(), + createGestureHandler: jest.fn(), + dropGestureHandler: jest.fn(), + updateGestureHandler: jest.fn(), + forceTouchAvailable: jest.fn(), + hasGenericPassword: jest.fn(), + getSupportedBiometryType: jest.fn(), + State: {}, + Directions: {}, + }, }; diff --git a/__mocks__/react-native-keychain.js b/__mocks__/react-native-keychain.js index 80d5c3d87d..8ee897d85b 100644 --- a/__mocks__/react-native-keychain.js +++ b/__mocks__/react-native-keychain.js @@ -1,21 +1,21 @@ export const ACCESS_CONTROL = { - BIOMETRY_CURRENT_SET: 'biometryCurrentSet', + BIOMETRY_CURRENT_SET: 'biometryCurrentSet', }; export const ACCESSIBLE = { - WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'whenUnlockedThisDeviceOnly', + WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'whenUnlockedThisDeviceOnly', }; export const AUTHENTICATION_TYPE = { - BIOMETRICS: 'biometrics', + BIOMETRICS: 'biometrics', }; export const SECURITY_LEVEL = { - SECURE_SOFTWARE: 'secureSoftware', + SECURE_SOFTWARE: 'secureSoftware', }; export const SECURITY_RULES = { - NONE: 'none', + NONE: 'none', }; export const STORAGE_TYPE = { - RSA : 'RSA', - AES_GCM_NO_AUTH: 'AES_GCM_NO_AUTH', + RSA: 'RSA', + AES_GCM_NO_AUTH: 'AES_GCM_NO_AUTH', }; export const setGenericPassword = jest.fn(); export const getGenericPassword = jest.fn(); diff --git a/__mocks__/react-native-localize.js b/__mocks__/react-native-localize.js index 7f0481d1e9..33833bfa62 100644 --- a/__mocks__/react-native-localize.js +++ b/__mocks__/react-native-localize.js @@ -1,6 +1,6 @@ export const getNumberFormatSettings = () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; + return { + decimalSeparator: '.', // us + groupingSeparator: ',', // us }; +}; diff --git a/__mocks__/react-native-reanimated.js b/__mocks__/react-native-reanimated.js index 015d8007af..a0e1199c1f 100644 --- a/__mocks__/react-native-reanimated.js +++ b/__mocks__/react-native-reanimated.js @@ -5,10 +5,10 @@ const Animated = class Animated { }; const useAnimatedStyle = jest.fn(() => ({})); -const useSharedValue = jest.fn((v) => ({ value: v })); +const useSharedValue = jest.fn(v => ({ value: v })); const useAnimatedGestureHandler = jest.fn(() => ({})); -const withTiming = jest.fn((v) => v); -const withSpring = jest.fn((v) => v); +const withTiming = jest.fn(v => v); +const withSpring = jest.fn(v => v); export default Animated; diff --git a/__mocks__/react-native.js b/__mocks__/react-native.js index 341aff3443..4c3215c3c4 100644 --- a/__mocks__/react-native.js +++ b/__mocks__/react-native.js @@ -5,9 +5,13 @@ jest.mock('react-native', () => { getLatestBlockServerInfo: jest.fn(() => '{}'), getLatestBlockWalletInfo: jest.fn(() => '{}'), walletExists: jest.fn(() => 'false'), - getValueTransfersList: jest.fn(() => '{ "value_transfers": [], "total": 0 }'), + getValueTransfersList: jest.fn( + () => '{ "value_transfers": [], "total": 0 }', + ), setCryptoDefaultProvider: jest.fn(() => 'true'), - createNewWallet: jest.fn(() => '{ "seed": "seed phrase test", "birthday": 0 }'), + createNewWallet: jest.fn( + () => '{ "seed": "seed phrase test", "birthday": 0 }', + ), doSave: jest.fn(), pollSyncInfo: jest.fn(() => '{}'), runSyncProcess: jest.fn(() => '{}'), diff --git a/__tests__/About.snapshot.tsx b/__tests__/About.snapshot.tsx index fb0b519e2a..c42aa36088 100644 --- a/__tests__/About.snapshot.tsx +++ b/__tests__/About.snapshot.tsx @@ -7,7 +7,10 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import About from '../components/About'; -import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/context'; +import { + ContextAppLoadedProvider, + defaultAppContextLoaded, +} from '../app/context'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; @@ -16,7 +19,10 @@ import { AppDrawerParamList } from '../app/types'; import { RouteEnum } from '../app/AppState'; import mockNavigation from '../__mocks__/dataMocks/mockNavigation'; -function makeDrawerProps(): DrawerScreenProps { +function makeDrawerProps(): DrawerScreenProps< + AppDrawerParamList, + RouteEnum.About +> { return { navigation: mockNavigation, route: { diff --git a/__tests__/AddressBook.AbDetail.snapshot.tsx b/__tests__/AddressBook.AbDetail.snapshot.tsx index 01184b2d40..1450534055 100644 --- a/__tests__/AddressBook.AbDetail.snapshot.tsx +++ b/__tests__/AddressBook.AbDetail.snapshot.tsx @@ -6,9 +6,17 @@ import 'react-native'; import React from 'react'; import { render, RenderResult } from '@testing-library/react-native'; -import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/context'; +import { + ContextAppLoadedProvider, + defaultAppContextLoaded, +} from '../app/context'; import AbDetail from '../components/AddressBook/components/AbDetail'; -import { AddressBookActionEnum, AddressBookFileClass, RouteEnum, ScreenEnum } from '../app/AppState'; +import { + AddressBookActionEnum, + AddressBookFileClass, + RouteEnum, + ScreenEnum, +} from '../app/AppState'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockAddressBook } from '../__mocks__/dataMocks/mockAddressBook'; diff --git a/__tests__/AddressBook.snapshot.tsx b/__tests__/AddressBook.snapshot.tsx index d187e8075f..6d39a18a7c 100644 --- a/__tests__/AddressBook.snapshot.tsx +++ b/__tests__/AddressBook.snapshot.tsx @@ -6,7 +6,10 @@ import 'react-native'; import React from 'react'; import { render, RenderResult } from '@testing-library/react-native'; -import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/context'; +import { + ContextAppLoadedProvider, + defaultAppContextLoaded, +} from '../app/context'; import { AddressBook } from '../components/AddressBook'; import { mockAddressBook } from '../__mocks__/dataMocks/mockAddressBook'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; @@ -15,7 +18,10 @@ import { AppDrawerParamList } from '../app/types'; import { RouteEnum } from '../app/AppState'; import mockNavigation from '../__mocks__/dataMocks/mockNavigation'; -function makeDrawerProps(): DrawerScreenProps { +function makeDrawerProps(): DrawerScreenProps< + AppDrawerParamList, + RouteEnum.AddressBook +> { return { navigation: mockNavigation, route: { diff --git a/__tests__/AddressList.snapshot.tsx b/__tests__/AddressList.snapshot.tsx index 90d2a709f8..90331ca4b5 100644 --- a/__tests__/AddressList.snapshot.tsx +++ b/__tests__/AddressList.snapshot.tsx @@ -6,7 +6,10 @@ import 'react-native'; import React from 'react'; import { render } from '@testing-library/react-native'; -import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/context'; +import { + ContextAppLoadedProvider, + defaultAppContextLoaded, +} from '../app/context'; import { AddressList } from '../components/AddressList'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockAddresses } from '../__mocks__/dataMocks/mockAddresses'; @@ -15,7 +18,9 @@ import { DrawerScreenProps } from '@react-navigation/drawer'; import { AppDrawerParamList } from '../app/types'; import mockNavigation from '../__mocks__/dataMocks/mockNavigation'; -function makeDrawerProps(ak: AddressKindEnum): DrawerScreenProps { +function makeDrawerProps( + ak: AddressKindEnum, +): DrawerScreenProps { return { navigation: mockNavigation, route: { diff --git a/__tests__/Button.snapshot.tsx b/__tests__/Button.snapshot.tsx index a2bdcd4fe6..97db9913aa 100644 --- a/__tests__/Button.snapshot.tsx +++ b/__tests__/Button.snapshot.tsx @@ -15,7 +15,13 @@ describe('Component Button - test', () => { const onPress = jest.fn(); test('Button Primary - snapshot', () => { const button = render( -