diff --git a/__mocks__/@fortawesome/react-native-fontawesome.js b/__mocks__/@fortawesome/react-native-fontawesome.js new file mode 100644 index 000000000..576376dea --- /dev/null +++ b/__mocks__/@fortawesome/react-native-fontawesome.js @@ -0,0 +1 @@ +export const FontAwesomeIcon = ''; diff --git a/__mocks__/@react-native-clipboard/clipboard.js b/__mocks__/@react-native-clipboard/clipboard.js new file mode 100644 index 000000000..d56718fa1 --- /dev/null +++ b/__mocks__/@react-native-clipboard/clipboard.js @@ -0,0 +1,2 @@ +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 new file mode 100644 index 000000000..f833bee3a --- /dev/null +++ b/__mocks__/@react-native-community/netinfo.js @@ -0,0 +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', + }; + +RN.NativeModules.RNCNetInfo = { + execute: jest.fn(() => '{}'), +}; + +export default { + 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 new file mode 100644 index 000000000..f833bee3a --- /dev/null +++ b/__mocks__/@react-native-community/netinfo/src/index.js @@ -0,0 +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', + }; + +RN.NativeModules.RNCNetInfo = { + execute: jest.fn(() => '{}'), +}; + +export default { + 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 new file mode 100644 index 000000000..3649e3118 --- /dev/null +++ b/__mocks__/@react-navigation/drawer.js @@ -0,0 +1,16 @@ +import React from 'react'; + +const MockNavigator = ({ children }) => children; +const MockScreen = ({ _name, children, component }) => { + if (typeof children === 'function') { + return children({ navigation: {} }); + } + + const Component = component; + return Component ? : <>{children}; +}; + +export const createDrawerNavigator = jest.fn(() => ({ + Navigator: MockNavigator, + Screen: MockScreen, +})); diff --git a/__mocks__/@react-navigation/elements.js b/__mocks__/@react-navigation/elements.js new file mode 100644 index 000000000..8ec3deaa8 --- /dev/null +++ b/__mocks__/@react-navigation/elements.js @@ -0,0 +1 @@ +export const PlatformPressable = jest.fn().mockImplementation(({ children }) => children); diff --git a/__mocks__/@react-navigation/native.js b/__mocks__/@react-navigation/native.js new file mode 100644 index 000000000..1c99717ca --- /dev/null +++ b/__mocks__/@react-navigation/native.js @@ -0,0 +1,7 @@ +import { mockTheme } from '../dataMocks/mockTheme'; + +export const useTheme = () => (mockTheme); +export const useScrollToTop = jest.fn(); +export const useIsFocused = jest.fn(); + +export const NavigationContainer = ({ children }) => children; diff --git a/__mocks__/@sayem314/react-native-keep-awake.js b/__mocks__/@sayem314/react-native-keep-awake.js index 94ab2a367..956f7d68e 100644 --- a/__mocks__/@sayem314/react-native-keep-awake.js +++ b/__mocks__/@sayem314/react-native-keep-awake.js @@ -1,9 +1,5 @@ // @sayem314/react-native-keep-awake.js -export const activateKeepAwake = jest.fn().mockImplementation(() => { - console.log('Mocked activateKeepAwake'); -}); +export const activateKeepAwake = jest.fn().mockImplementation(() => {}); -export const deactivateKeepAwake = jest.fn().mockImplementation(() => { - console.log('Mocked deactivateKeepAwake'); -}); +export const deactivateKeepAwake = jest.fn().mockImplementation(() => {}); diff --git a/__mocks__/createNativeStackNavigator.tsx b/__mocks__/createNativeStackNavigator.tsx deleted file mode 100644 index f95cffe64..000000000 --- a/__mocks__/createNativeStackNavigator.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import React from 'react'; -import { createStackNavigator } from '@react-navigation/stack'; - -const createNativeStackNavigator = () => { - const Stack = createStackNavigator(); - - return { - ...Stack, - Navigator: (props: any) => ( - - ), - }; -}; - -export default createNativeStackNavigator; diff --git a/__mocks__/i18n-js.js b/__mocks__/i18n-js.js index 5dd88cc5c..8f4a75ab8 100644 --- a/__mocks__/i18n-js.js +++ b/__mocks__/i18n-js.js @@ -2,7 +2,10 @@ import { LanguageEnum } from '../app/AppState'; -export const I18n = { - t: jest.fn().mockImplementation(key => key), - locale: LanguageEnum.en, -}; +export default () => ({ + __esModule: true, + I18n: jest.fn().mockImplementation(() => ({ + t: jest.fn(), + locale: LanguageEnum.en, + })), +}); diff --git a/__mocks__/moment.js b/__mocks__/moment.js new file mode 100644 index 000000000..253b71989 --- /dev/null +++ b/__mocks__/moment.js @@ -0,0 +1,17 @@ +const mMoment = { + format: (p) => { + if (p === 'MMM YYYY') { + return 'Dec 2022'; + } else if (p === 'YYYY MMM D h:mm a') { + return '2022 Dec 13 8:00 am'; + } else if (p === 'MMM D, h:mm a') { + return 'Dec 13, 8:00 am'; + } + }, +}; +const fn = () => { + return mMoment; +}; +fn.default = fn; +fn.locale = jest.fn(); +export default fn; diff --git a/__mocks__/moment/locale/es.js b/__mocks__/moment/locale/es.js new file mode 100644 index 000000000..24ae07ecd --- /dev/null +++ b/__mocks__/moment/locale/es.js @@ -0,0 +1,3 @@ +export default () => () => ({ + defineLocale: jest.fn(), +}); diff --git a/__mocks__/moment/locale/pt.js b/__mocks__/moment/locale/pt.js new file mode 100644 index 000000000..24ae07ecd --- /dev/null +++ b/__mocks__/moment/locale/pt.js @@ -0,0 +1,3 @@ +export default () => () => ({ + defineLocale: jest.fn(), +}); diff --git a/__mocks__/moment/locale/ru.js b/__mocks__/moment/locale/ru.js new file mode 100644 index 000000000..24ae07ecd --- /dev/null +++ b/__mocks__/moment/locale/ru.js @@ -0,0 +1,3 @@ +export default () => () => ({ + defineLocale: jest.fn(), +}); diff --git a/__mocks__/react-native-bouncy-checkbox.js b/__mocks__/react-native-bouncy-checkbox.js index e69de29bb..1b337ae24 100644 --- a/__mocks__/react-native-bouncy-checkbox.js +++ b/__mocks__/react-native-bouncy-checkbox.js @@ -0,0 +1 @@ +export default () => 'BouncyCheckbox'; diff --git a/__mocks__/react-native-context-menu-view.js b/__mocks__/react-native-context-menu-view.js new file mode 100644 index 000000000..e69de29bb diff --git a/__mocks__/react-native-device-info.js b/__mocks__/react-native-device-info.js index e69de29bb..470408a9c 100644 --- a/__mocks__/react-native-device-info.js +++ b/__mocks__/react-native-device-info.js @@ -0,0 +1,4 @@ +export const getSystemName = jest.fn(() => 'Mocked System Name'); +export const getSystemVersion = jest.fn(() => 'Mocked System Version'); +export const getManufacturer = jest.fn(() => 'Mocked Manufacturer'); +export const getModel = jest.fn(() => 'Mocked Model'); diff --git a/__mocks__/react-native-easy-biometrics.js b/__mocks__/react-native-easy-biometrics.js new file mode 100644 index 000000000..4437bffca --- /dev/null +++ b/__mocks__/react-native-easy-biometrics.js @@ -0,0 +1 @@ +export const requestBioAuth = jest.fn(() => Promise.resolve(true)); diff --git a/__mocks__/react-native-fs.js b/__mocks__/react-native-fs.js index e69de29bb..c3477d583 100644 --- a/__mocks__/react-native-fs.js +++ b/__mocks__/react-native-fs.js @@ -0,0 +1,2 @@ +export const readFile = jest.fn(() => Promise.resolve('{}')); +export const writeFile = jest.fn(() => Promise.resolve()); diff --git a/__mocks__/react-native-gesture-handler.js b/__mocks__/react-native-gesture-handler.js index e69de29bb..5eeb5070d 100644 --- a/__mocks__/react-native-gesture-handler.js +++ b/__mocks__/react-native-gesture-handler.js @@ -0,0 +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: {}, + }, +}; diff --git a/__mocks__/react-native-gifted-charts.js b/__mocks__/react-native-gifted-charts.js index e69de29bb..9b92d2779 100644 --- a/__mocks__/react-native-gifted-charts.js +++ b/__mocks__/react-native-gifted-charts.js @@ -0,0 +1 @@ +export const PieChart = jest.fn().mockReturnValue(null); diff --git a/__mocks__/react-native-keychain.js b/__mocks__/react-native-keychain.js index e69de29bb..80d5c3d87 100644 --- a/__mocks__/react-native-keychain.js +++ b/__mocks__/react-native-keychain.js @@ -0,0 +1,24 @@ +export const ACCESS_CONTROL = { + BIOMETRY_CURRENT_SET: 'biometryCurrentSet', +}; +export const ACCESSIBLE = { + WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'whenUnlockedThisDeviceOnly', +}; +export const AUTHENTICATION_TYPE = { + BIOMETRICS: 'biometrics', +}; +export const SECURITY_LEVEL = { + SECURE_SOFTWARE: 'secureSoftware', +}; +export const SECURITY_RULES = { + NONE: 'none', +}; +export const STORAGE_TYPE = { + RSA : 'RSA', + AES_GCM_NO_AUTH: 'AES_GCM_NO_AUTH', +}; +export const setGenericPassword = jest.fn(); +export const getGenericPassword = jest.fn(); +export const resetGenericPassword = jest.fn(); +export const getSupportedBiometryType = jest.fn(); +export const hasGenericPassword = jest.fn(); diff --git a/__mocks__/react-native-localize.js b/__mocks__/react-native-localize.js index e69de29bb..7f0481d1e 100644 --- a/__mocks__/react-native-localize.js +++ b/__mocks__/react-native-localize.js @@ -0,0 +1,6 @@ +export const getNumberFormatSettings = () => { + return { + decimalSeparator: '.', // us + groupingSeparator: ',', // us + }; + }; diff --git a/__mocks__/react-native-picker-select.js b/__mocks__/react-native-picker-select.js new file mode 100644 index 000000000..9793945cf --- /dev/null +++ b/__mocks__/react-native-picker-select.js @@ -0,0 +1 @@ +export default () => 'RNPickerSelect'; diff --git a/__mocks__/react-native-safe-area-context.js b/__mocks__/react-native-safe-area-context.js new file mode 100644 index 000000000..156dd2907 --- /dev/null +++ b/__mocks__/react-native-safe-area-context.js @@ -0,0 +1,3 @@ +export const SafeAreaProvider = ({ children }) => children; +export const SafeAreaView = ({ children }) => children; +export const useSafeAreaInsets = () => ({ top: 0, left: 0, right: 0, bottom: 0 }); diff --git a/__mocks__/react-native-snackbar.js b/__mocks__/react-native-snackbar.js index 2c0dfae58..c994591da 100644 --- a/__mocks__/react-native-snackbar.js +++ b/__mocks__/react-native-snackbar.js @@ -1,10 +1,4 @@ -// react-native-snackbar.js - export default { - show: jest.fn().mockImplementation(message => { - console.log(`Mocked Snackbar show: ${message}`); - }), - dismiss: jest.fn().mockImplementation(() => { - console.log('Mocked Snackbar dismiss'); - }), + show: jest.fn().mockImplementation(() => {}), + dismiss: jest.fn().mockImplementation(() => {}), }; diff --git a/__mocks__/react-native-svg-charts.js b/__mocks__/react-native-svg-charts.js deleted file mode 100644 index 9b92d2779..000000000 --- a/__mocks__/react-native-svg-charts.js +++ /dev/null @@ -1 +0,0 @@ -export const PieChart = jest.fn().mockReturnValue(null); diff --git a/__mocks__/react-native-tab-view.js b/__mocks__/react-native-tab-view.js index e69de29bb..a892d9ad2 100644 --- a/__mocks__/react-native-tab-view.js +++ b/__mocks__/react-native-tab-view.js @@ -0,0 +1,2 @@ +export const TabView = ''; +export const TabBar = ''; diff --git a/__mocks__/react-native.js b/__mocks__/react-native.js new file mode 100644 index 000000000..a20c338b7 --- /dev/null +++ b/__mocks__/react-native.js @@ -0,0 +1,16 @@ +jest.mock('react-native', () => { + const RN = jest.requireActual('react-native'); + + RN.NativeModules.RPCModule = { + execute: jest.fn(() => '{}'), + getLatestBlock: jest.fn(() => '{}'), + walletExists: jest.fn(() => 'false'), + getValueTransfersList: jest.fn(() => '{ "value_transfers": [], "total": 0 }'), + setCryptoDefaultProvider: jest.fn(() => 'true'), + createNewWallet: jest.fn(() => '{ "seed": "seed phrase test", "birthday": 0 }'), + doSave: jest.fn(), + }; + RN.View = jest.fn(); + + return RN; +}); diff --git a/__tests__/About.snapshot.tsx b/__tests__/About.snapshot.tsx index 570d579ed..d8aa01c41 100644 --- a/__tests__/About.snapshot.tsx +++ b/__tests__/About.snapshot.tsx @@ -11,52 +11,6 @@ import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/contex import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component About - test', () => { diff --git a/__tests__/AddressBook.AbDetail.snapshot.tsx b/__tests__/AddressBook.AbDetail.snapshot.tsx index 18968bc95..9df5afc0d 100644 --- a/__tests__/AddressBook.AbDetail.snapshot.tsx +++ b/__tests__/AddressBook.AbDetail.snapshot.tsx @@ -11,49 +11,6 @@ import AbDetail from '../components/AddressBook/components/AbDetail'; import { AddressBookActionEnum, AddressBookFileClass } from '../app/AppState'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockAddressBook } from '../__mocks__/dataMocks/mockAddressBook'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useScrollToTop: jest.fn(), - useTheme: () => mockTheme, -})); // test suite describe('Component Address Book Details - test', () => { diff --git a/__tests__/AddressBook.snapshot.tsx b/__tests__/AddressBook.snapshot.tsx index 2837cf47d..eecc6f32e 100644 --- a/__tests__/AddressBook.snapshot.tsx +++ b/__tests__/AddressBook.snapshot.tsx @@ -10,49 +10,6 @@ import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/contex import { AddressBook } from '../components/AddressBook'; import { mockAddressBook } from '../__mocks__/dataMocks/mockAddressBook'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useScrollToTop: jest.fn(), - useTheme: () => mockTheme, -})); // test suite describe('Component Address Book - test', () => { diff --git a/__tests__/App.snapshot.tsx b/__tests__/App.snapshot.tsx index f73ed418a..87f30a132 100644 --- a/__tests__/App.snapshot.tsx +++ b/__tests__/App.snapshot.tsx @@ -8,117 +8,6 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import App from '../App'; -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native-tab-view', () => ({ - TabView: '', - TabBar: '', -})); -jest.mock('react-native-context-menu-view', () => ''); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - getValueTransfersList: jest.fn(() => '{ "value_transfers": [], "total": 0 }'), - }; - - return RN; -}); -jest.mock('react-native-picker-select', () => 'RNPickerSelect'); -jest.mock('react-native-device-info', () => ({ - getSystemName: jest.fn(() => 'Mocked System Name'), - getSystemVersion: jest.fn(() => 'Mocked System Version'), - getManufacturer: jest.fn(() => 'Mocked Manufacturer'), - getModel: jest.fn(() => 'Mocked Model'), -})); - -jest.mock('@react-navigation/drawer', () => { - const MockNavigator = ({ children }: { children: React.ReactNode }) => <>{children}; - const MockScreen = () => null; // No-op component - - return { - createDrawerNavigator: jest.fn(() => ({ - Navigator: MockNavigator, - Screen: MockScreen, - })), - }; -}); - -jest.mock('react-native-gesture-handler', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNGestureHandlerModule = { - attachGestureHandler: jest.fn(), - createGestureHandler: jest.fn(), - dropGestureHandler: jest.fn(), - updateGestureHandler: jest.fn(), - forceTouchAvailable: jest.fn(), - hasGenericPassword: jest.fn(), - getSupportedBiometryType: jest.fn(), - State: {}, - Directions: {}, - }; - return { - RNGestureHandlerModule: RN, - }; -}); -jest.mock('react-native-keychain', () => ({ - ACCESS_CONTROL: { - BIOMETRY_CURRENT_SET: 'biometryCurrentSet', - }, - ACCESSIBLE: { - WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'whenUnlockedThisDeviceOnly', - }, - AUTHENTICATION_TYPE: { - BIOMETRICS: 'biometrics', - }, - SECURITY_LEVEL: { - SECURE_SOFTWARE: 'secureSoftware', - }, - SECURITY_RULES: { - NONE: 'none', - }, - STORAGE_TYPE: { - AES: 'AES', - }, - setGenericPassword: jest.fn(), - getGenericPassword: jest.fn(), - resetGenericPassword: jest.fn(), -})); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/elements', () => ({ - PlatformPressable: jest.fn().mockImplementation(({ children }) => children), -})); - // test suite describe('Component App - test', () => { //snapshot test diff --git a/__tests__/Button.snapshot.tsx b/__tests__/Button.snapshot.tsx index 8cd39a80d..a2bdcd4fe 100644 --- a/__tests__/Button.snapshot.tsx +++ b/__tests__/Button.snapshot.tsx @@ -8,12 +8,6 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import Button from '../components/Components/Button'; import { ButtonTypeEnum } from '../app/AppState'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Button - test', () => { diff --git a/__tests__/ChainTypeToggle.snapshot.tsx b/__tests__/ChainTypeToggle.snapshot.tsx index a13e54eae..1a168ad68 100644 --- a/__tests__/ChainTypeToggle.snapshot.tsx +++ b/__tests__/ChainTypeToggle.snapshot.tsx @@ -9,16 +9,6 @@ import { render } from '@testing-library/react-native'; import ChainTypeToggle from '../components/Components/ChainTypeToggle'; import { ChainNameEnum } from '../app/AppState'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component ChainTypeToggle - test', () => { diff --git a/__tests__/CircularProgress.snapshot.tsx b/__tests__/CircularProgress.snapshot.tsx index 0181b32e9..2fbd5b4bb 100644 --- a/__tests__/CircularProgress.snapshot.tsx +++ b/__tests__/CircularProgress.snapshot.tsx @@ -7,12 +7,6 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import CircularProgress from '../components/Components/CircularProgress'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component CircularProgress - test', () => { diff --git a/__tests__/Components.snapshot.tsx b/__tests__/Components.snapshot.tsx index 40c32c8b0..25157a3f7 100644 --- a/__tests__/Components.snapshot.tsx +++ b/__tests__/Components.snapshot.tsx @@ -13,21 +13,6 @@ import FadeText from '../components/Components/FadeText'; import ErrorText from '../components/Components/ErrorText'; import RegText from '../components/Components/RegText'; import { CurrencyEnum, CurrencyNameEnum } from '../app/AppState'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Components - test', () => { diff --git a/__tests__/Components.unit.tsx b/__tests__/Components.unit.tsx index 455006d43..93300db73 100644 --- a/__tests__/Components.unit.tsx +++ b/__tests__/Components.unit.tsx @@ -13,21 +13,6 @@ import FadeText from '../components/Components/FadeText'; import ErrorText from '../components/Components/ErrorText'; import RegText from '../components/Components/RegText'; import { CurrencyEnum, CurrencyNameEnum } from '../app/AppState'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Components - test', () => { diff --git a/__tests__/DetailLine.snapshot.tsx b/__tests__/DetailLine.snapshot.tsx index 209a785be..780b05f81 100644 --- a/__tests__/DetailLine.snapshot.tsx +++ b/__tests__/DetailLine.snapshot.tsx @@ -7,17 +7,7 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import DetailLine from '../components/Components/DetailLine'; -import { View } from 'react-native'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); +import RegText from '../components/Components/RegText'; // test suite describe('Component DetailLine - test', () => { @@ -27,7 +17,7 @@ describe('Component DetailLine - test', () => { expect(detail.toJSON()).toMatchSnapshot(); }); test('DetailLine children - snapshot', () => { - const children = ; + const children = {'Hello'}; const detail = render(); expect(detail.toJSON()).toMatchSnapshot(); }); diff --git a/__tests__/Drawer.snapshot.tsx b/__tests__/Drawer.snapshot.tsx index a4d9117c6..5dd5062f7 100644 --- a/__tests__/Drawer.snapshot.tsx +++ b/__tests__/Drawer.snapshot.tsx @@ -8,23 +8,12 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import Drawer from '../components/Drawer'; -jest.mock('@react-navigation/drawer', () => { - const MockNavigator = ({ children }: { children: React.ReactNode }) => <>{children}; - const MockScreen = () => null; // No-op component - - return { - createDrawerNavigator: jest.fn(() => ({ - Navigator: MockNavigator, - Screen: MockScreen, - })), - }; -}); - // test suite describe('Drawer Component', () => { it('renders correctly with screens', () => { + const onAction = jest.fn(); const { toJSON } = render( - + <>} /> <>} /> , diff --git a/__tests__/Header.snapshot.tsx b/__tests__/Header.snapshot.tsx index 9a3c0bd06..4595b7d2b 100644 --- a/__tests__/Header.snapshot.tsx +++ b/__tests__/Header.snapshot.tsx @@ -11,48 +11,6 @@ import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/contex import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Header - test', () => { diff --git a/__tests__/History.ValueTransferDetail.unit.tsx b/__tests__/History.ValueTransferDetail.unit.tsx index 4d4d25b46..d1ecb8731 100644 --- a/__tests__/History.ValueTransferDetail.unit.tsx +++ b/__tests__/History.ValueTransferDetail.unit.tsx @@ -12,90 +12,6 @@ import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockValueTransfers } from '../__mocks__/dataMocks/mockValueTransfers'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('moment', () => { - // Here we are able to mock chain builder pattern - const mMoment = { - format: (p: string) => { - if (p === 'MMM YYYY') { - return 'Dec 2022'; - } else if (p === 'YYYY MMM D h:mm a') { - return '2022 Dec 13 8:00 am'; - } else if (p === 'MMM D, h:mm a') { - return 'Dec 13, 8:00 am'; - } - }, - }; - // Here we are able to mock the constructor and to modify instance methods - const fn = () => { - return mMoment; - }; - // Here we are able to mock moment methods that depend on moment not on a moment instance - fn.locale = jest.fn(); - return fn; -}); -jest.mock('moment/locale/es', () => () => ({ - defineLocale: jest.fn(), -})); -jest.mock('moment/locale/pt', () => () => ({ - defineLocale: jest.fn(), -})); - -jest.mock('moment/locale/ru', () => () => ({ - defineLocale: jest.fn(), -})); - -jest.mock('react-native-gesture-handler', () => { - const View = require('react-native').View; - return { - TouchableOpacity: View, - }; -}); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component History ValueTransferDetail - test', () => { diff --git a/__tests__/History.snapshot.tsx b/__tests__/History.snapshot.tsx index b14971b7f..aba203c6b 100644 --- a/__tests__/History.snapshot.tsx +++ b/__tests__/History.snapshot.tsx @@ -14,102 +14,6 @@ import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockAddresses } from '../__mocks__/dataMocks/mockAddresses'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('moment', () => { - // Here we are able to mock chain builder pattern - const mMoment = { - format: (p: string) => { - if (p === 'MMM YYYY') { - return 'Dec 2022'; - } else if (p === 'YYYY MMM D h:mm a') { - return '2022 Dec 13 8:00 am'; - } else if (p === 'MMM D, h:mm a') { - return 'Dec 13, 8:00 am'; - } - }, - }; - // Here we are able to mock the constructor and to modify instance methods - const fn = () => { - return mMoment; - }; - // Here we are able to mock moment methods that depend on moment not on a moment instance - fn.locale = jest.fn(); - return fn; -}); -jest.mock('moment/locale/es', () => () => ({ - defineLocale: jest.fn(), -})); -jest.mock('moment/locale/pt', () => () => ({ - defineLocale: jest.fn(), -})); -jest.mock('moment/locale/ru', () => () => ({ - defineLocale: jest.fn(), -})); - -jest.mock('react-native-gesture-handler', () => { - const View = require('react-native').View; - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNGestureHandlerModule = { - attachGestureHandler: jest.fn(), - createGestureHandler: jest.fn(), - dropGestureHandler: jest.fn(), - updateGestureHandler: jest.fn(), - forceTouchAvailable: jest.fn(), - State: {}, - Directions: {}, - }; - return { - Swipeable: View, - RNGestureHandlerModule: RN, - }; -}); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useScrollToTop: jest.fn(), - useTheme: () => mockTheme, -})); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); // test suite describe('Component History - test', () => { diff --git a/__tests__/ImportUfvk.snapshot.tsx b/__tests__/ImportUfvk.snapshot.tsx index 2ed405813..7578f3df4 100644 --- a/__tests__/ImportUfvk.snapshot.tsx +++ b/__tests__/ImportUfvk.snapshot.tsx @@ -11,53 +11,6 @@ import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/contex import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - getLatestBlock: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component ImportUfvk - test', () => { diff --git a/__tests__/Info.es.unit.tsx b/__tests__/Info.es.unit.tsx index 262b52c24..7fa8df279 100644 --- a/__tests__/Info.es.unit.tsx +++ b/__tests__/Info.es.unit.tsx @@ -11,17 +11,8 @@ import { ContextAppLoadedProvider, defaultAppContextLoaded } from '../app/contex import { CurrencyEnum } from '../app/AppState'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockZecPrice } from '../__mocks__/dataMocks/mockZecPrice'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); +// don't delete -> mocking in Spanish. jest.mock('react-native-localize', () => ({ getNumberFormatSettings: () => { return { @@ -30,33 +21,6 @@ jest.mock('react-native-localize', () => ({ }; }, })); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Info - test', () => { diff --git a/__tests__/Info.snapshot.tsx b/__tests__/Info.snapshot.tsx index da5167820..bf9bdd06d 100644 --- a/__tests__/Info.snapshot.tsx +++ b/__tests__/Info.snapshot.tsx @@ -12,52 +12,6 @@ import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockZecPrice } from '../__mocks__/dataMocks/mockZecPrice'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Info - test', () => { diff --git a/__tests__/Info.us.unit.tsx b/__tests__/Info.us.unit.tsx index f86a84ff4..c320389f3 100644 --- a/__tests__/Info.us.unit.tsx +++ b/__tests__/Info.us.unit.tsx @@ -11,52 +11,6 @@ import { defaultAppContextLoaded, ContextAppLoadedProvider } from '../app/contex import { CurrencyEnum } from '../app/AppState'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockZecPrice } from '../__mocks__/dataMocks/mockZecPrice'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Info - test', () => { diff --git a/__tests__/Insight.snapshot.tsx b/__tests__/Insight.snapshot.tsx index 4449e0604..b596f7043 100644 --- a/__tests__/Insight.snapshot.tsx +++ b/__tests__/Insight.snapshot.tsx @@ -11,48 +11,6 @@ import { defaultAppContextLoaded, ContextAppLoadedProvider } from '../app/contex import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-svg-charts'); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('react-native-gifted-charts', () => ({ - PieChart: jest.fn(() => null), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Insight - test', () => { diff --git a/__tests__/LoadedApp.snapshot.tsx b/__tests__/LoadedApp.snapshot.tsx index a8d8210a2..632eb13e3 100644 --- a/__tests__/LoadedApp.snapshot.tsx +++ b/__tests__/LoadedApp.snapshot.tsx @@ -21,146 +21,6 @@ import { mockBackground } from '../__mocks__/dataMocks/mockBackground'; import { mockSecurity } from '../__mocks__/dataMocks/mockSecurity'; import { mockAddressBook } from '../__mocks__/dataMocks/mockAddressBook'; -// Crea un mock para el constructor de I18n -jest.mock('i18n-js', () => ({ - __esModule: true, - I18n: jest.fn().mockImplementation(() => ({ - t: jest.fn(), - // Agrega otros métodos y propiedades según sea necesario para tus pruebas - })), -})); - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native-tab-view', () => ({ - TabView: '', - TabBar: '', -})); -jest.mock('react-native-context-menu-view', () => ''); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - return { - addEventListener: jest.fn(), - fetch: jest.fn().mockImplementation(() => - Promise.resolve({ - isConnected: true, - isInternetReachable: true, - }), - ), - }; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '[]'), - getValueTransfersList: jest.fn(() => '{ "value_transfers": [], "total": 0 }'), - }; - - return RN; -}); -jest.mock('react-native-fs', () => ({ - readFile: jest.fn(() => Promise.resolve('{}')), // o Promise.reject(new Error('File not found')) - writeFile: jest.fn(() => Promise.resolve()), // o Promise.reject(new Error('Write failed')) - // Agrega más funciones mockeadas según sea necesario -})); -jest.mock('react-native-picker-select', () => 'RNPickerSelect'); -jest.mock('react-native-device-info', () => ({ - getSystemName: jest.fn(() => 'Mocked System Name'), - getSystemVersion: jest.fn(() => 'Mocked System Version'), - getManufacturer: jest.fn(() => 'Mocked Manufacturer'), - getModel: jest.fn(() => 'Mocked Model'), -})); - -jest.mock('@react-navigation/drawer', () => { - const MockNavigator = ({ children }: { children: React.ReactNode }) => <>{children}; - const MockScreen = ({ name, children, component }: any) => { - if (typeof children === 'function') { - return children({ navigation: {} }); - } - - const Component = component; - return Component ? : <>{children}; - }; - - return { - createDrawerNavigator: jest.fn(() => ({ - Navigator: MockNavigator, - Screen: MockScreen, - })), - }; -}); - -jest.mock('react-native-gesture-handler', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNGestureHandlerModule = { - attachGestureHandler: jest.fn(), - createGestureHandler: jest.fn(), - dropGestureHandler: jest.fn(), - updateGestureHandler: jest.fn(), - forceTouchAvailable: jest.fn(), - hasGenericPassword: jest.fn(), - getSupportedBiometryType: jest.fn(), - State: {}, - Directions: {}, - }; - - return { - RNGestureHandlerModule: RN, - GestureHandlerRootView: ({ children }: { children: React.ReactNode }) => children, - }; -}); -jest.mock('react-native-keychain', () => ({ - ACCESS_CONTROL: { - BIOMETRY_CURRENT_SET: 'biometryCurrentSet', - }, - ACCESSIBLE: { - WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'whenUnlockedThisDeviceOnly', - }, - AUTHENTICATION_TYPE: { - BIOMETRICS: 'biometrics', - }, - SECURITY_LEVEL: { - SECURE_SOFTWARE: 'secureSoftware', - }, - SECURITY_RULES: { - NONE: 'none', - }, - STORAGE_TYPE: { - AES: 'AES', - }, - setGenericPassword: jest.fn(), - getGenericPassword: jest.fn(), - resetGenericPassword: jest.fn(), -})); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/elements', () => ({ - PlatformPressable: jest.fn().mockImplementation(({ children }) => children), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => mockTheme, -})); - // test suite describe('Component LoadedApp - test', () => { //snapshot test diff --git a/__tests__/LoadingApp.snapshot.tsx b/__tests__/LoadingApp.snapshot.tsx index 91fda4756..133df3eda 100644 --- a/__tests__/LoadingApp.snapshot.tsx +++ b/__tests__/LoadingApp.snapshot.tsx @@ -20,113 +20,6 @@ import { mockServer } from '../__mocks__/dataMocks/mockServer'; import { mockBackground } from '../__mocks__/dataMocks/mockBackground'; import { mockSecurity } from '../__mocks__/dataMocks/mockSecurity'; -// Crea un mock para el constructor de I18n -jest.mock('i18n-js', () => ({ - __esModule: true, - I18n: jest.fn().mockImplementation(() => ({ - t: jest.fn(), - // Agrega otros métodos y propiedades según sea necesario para tus pruebas - })), -})); - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native-tab-view', () => ({ - TabView: '', - TabBar: '', -})); -jest.mock('react-native-context-menu-view', () => ''); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - return { - addEventListener: jest.fn(), - fetch: jest.fn().mockImplementation(() => - Promise.resolve({ - isConnected: true, - isInternetReachable: true, - }), - ), - }; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - getLatestBlock: jest.fn(() => '{}'), - walletExists: jest.fn(() => 'false'), - getValueTransfersList: jest.fn(() => '{ "value_transfers": [], "total": 0 }'), - setCryptoDefaultProvider: jest.fn(() => 'true'), - }; - - return RN; -}); -jest.mock('react-native-easy-biometrics', () => ({ - requestBioAuth: jest.fn(() => Promise.resolve(true)), -})); -jest.mock('react-native-fs', () => ({ - readFile: jest.fn(() => Promise.resolve('{}')), // o Promise.reject(new Error('File not found')) - writeFile: jest.fn(() => Promise.resolve()), // o Promise.reject(new Error('Write failed')) - // Agrega más funciones mockeadas según sea necesario -})); -jest.mock('react-native-device-info', () => ({ - getSystemName: jest.fn(() => 'Mocked System Name'), - getSystemVersion: jest.fn(() => 'Mocked System Version'), - getManufacturer: jest.fn(() => 'Mocked Manufacturer'), - getModel: jest.fn(() => 'Mocked Model'), -})); -jest.mock('react-native-keychain', () => ({ - ACCESS_CONTROL: { - BIOMETRY_CURRENT_SET: 'biometryCurrentSet', - }, - ACCESSIBLE: { - WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'whenUnlockedThisDeviceOnly', - }, - AUTHENTICATION_TYPE: { - BIOMETRICS: 'biometrics', - }, - SECURITY_LEVEL: { - SECURE_SOFTWARE: 'secureSoftware', - }, - SECURITY_RULES: { - NONE: 'none', - }, - STORAGE_TYPE: { - AES: 'AES', - }, - setGenericPassword: jest.fn(), - getGenericPassword: jest.fn(), - resetGenericPassword: jest.fn(), - hasGenericPassword: jest.fn(), - getSupportedBiometryType: jest.fn(), -})); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/elements', () => ({ - PlatformPressable: jest.fn().mockImplementation(({ children }) => children), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); - // test suite describe('Component LoadingApp - test', () => { //snapshot test diff --git a/__tests__/Memo.snapshot.tsx b/__tests__/Memo.snapshot.tsx index 2ad7b8a77..e4b2dfd91 100644 --- a/__tests__/Memo.snapshot.tsx +++ b/__tests__/Memo.snapshot.tsx @@ -9,48 +9,6 @@ import { render } from '@testing-library/react-native'; import Memo from '../components/Memo'; import { defaultAppContextLoaded, ContextAppLoadedProvider } from '../app/context'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Memo - test', () => { diff --git a/__tests__/Messages.snapshot.tsx b/__tests__/Messages.snapshot.tsx index 7e87c41f3..9e08c23fd 100644 --- a/__tests__/Messages.snapshot.tsx +++ b/__tests__/Messages.snapshot.tsx @@ -14,91 +14,6 @@ import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockAddresses } from '../__mocks__/dataMocks/mockAddresses'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('moment', () => { - // Here we are able to mock chain builder pattern - const mMoment = { - format: (p: string) => { - if (p === 'MMM YYYY') { - return 'Dec 2022'; - } else if (p === 'YYYY MMM D h:mm a') { - return '2022 Dec 13 8:00 am'; - } else if (p === 'MMM D, h:mm a') { - return 'Dec 13, 8:00 am'; - } - }, - }; - // Here we are able to mock the constructor and to modify instance methods - const fn = () => { - return mMoment; - }; - // Here we are able to mock moment methods that depend on moment not on a moment instance - fn.locale = jest.fn(); - return fn; -}); -jest.mock('moment/locale/es', () => () => ({ - defineLocale: jest.fn(), -})); -jest.mock('moment/locale/pt', () => () => ({ - defineLocale: jest.fn(), -})); -jest.mock('moment/locale/ru', () => () => ({ - defineLocale: jest.fn(), -})); - -jest.mock('react-native-gesture-handler', () => { - const View = require('react-native').View; - return { - TouchableOpacity: View, - Swipeable: View, - }; -}); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useScrollToTop: jest.fn(), - useTheme: () => mockTheme, -})); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); // test suite describe('Component Messages - test', () => { diff --git a/__tests__/MessagesAddress.snapshot.tsx b/__tests__/MessagesAddress.snapshot.tsx index b7d1aa7df..11469ab80 100644 --- a/__tests__/MessagesAddress.snapshot.tsx +++ b/__tests__/MessagesAddress.snapshot.tsx @@ -14,91 +14,6 @@ import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockAddresses } from '../__mocks__/dataMocks/mockAddresses'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('moment', () => { - // Here we are able to mock chain builder pattern - const mMoment = { - format: (p: string) => { - if (p === 'MMM YYYY') { - return 'Dec 2022'; - } else if (p === 'YYYY MMM D h:mm a') { - return '2022 Dec 13 8:00 am'; - } else if (p === 'MMM D, h:mm a') { - return 'Dec 13, 8:00 am'; - } - }, - }; - // Here we are able to mock the constructor and to modify instance methods - const fn = () => { - return mMoment; - }; - // Here we are able to mock moment methods that depend on moment not on a moment instance - fn.locale = jest.fn(); - return fn; -}); -jest.mock('moment/locale/es', () => () => ({ - defineLocale: jest.fn(), -})); -jest.mock('moment/locale/pt', () => () => ({ - defineLocale: jest.fn(), -})); -jest.mock('moment/locale/ru', () => () => ({ - defineLocale: jest.fn(), -})); - -jest.mock('react-native-gesture-handler', () => { - const View = require('react-native').View; - return { - TouchableOpacity: View, - Swipeable: View, - }; -}); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useScrollToTop: jest.fn(), - useTheme: () => mockTheme, -})); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); // test suite describe('Component Messages Address - test', () => { diff --git a/__tests__/Pools.snapshot.tsx b/__tests__/Pools.snapshot.tsx index ed6d9170f..d7458fc79 100644 --- a/__tests__/Pools.snapshot.tsx +++ b/__tests__/Pools.snapshot.tsx @@ -11,52 +11,6 @@ import { defaultAppContextLoaded, ContextAppLoadedProvider } from '../app/contex import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Pools - test', () => { diff --git a/__tests__/PriceFetcher.snapshot.tsx b/__tests__/PriceFetcher.snapshot.tsx index 8a580a89b..74e406afe 100644 --- a/__tests__/PriceFetcher.snapshot.tsx +++ b/__tests__/PriceFetcher.snapshot.tsx @@ -7,16 +7,6 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import PriceFetcher from '../components/Components/PriceFetcher'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component PriceFetcher - test', () => { diff --git a/__tests__/PrivKey.snapshot.tsx b/__tests__/PrivKey.snapshot.tsx index c8db20ab9..7e62fc297 100644 --- a/__tests__/PrivKey.snapshot.tsx +++ b/__tests__/PrivKey.snapshot.tsx @@ -11,52 +11,6 @@ import { defaultAppContextLoaded, ContextAppLoadedProvider } from '../app/contex import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component PrivKey - test', () => { diff --git a/__tests__/Receive.snapshot.tsx b/__tests__/Receive.snapshot.tsx index fccb740ff..0bd248b2d 100644 --- a/__tests__/Receive.snapshot.tsx +++ b/__tests__/Receive.snapshot.tsx @@ -12,57 +12,6 @@ import { mockAddresses } from '../__mocks__/dataMocks/mockAddresses'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native-tab-view', () => ({ - TabView: '', - TabBar: '', -})); -jest.mock('react-native-context-menu-view', () => ''); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Receive - test', () => { diff --git a/__tests__/Rescan.snapshot.tsx b/__tests__/Rescan.snapshot.tsx index 80688d239..3f6593220 100644 --- a/__tests__/Rescan.snapshot.tsx +++ b/__tests__/Rescan.snapshot.tsx @@ -12,48 +12,6 @@ import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockWallet } from '../__mocks__/dataMocks/mockWallet'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Rescan - test', () => { diff --git a/__tests__/Scanner.snapshot.tsx b/__tests__/Scanner.snapshot.tsx index adca88ee3..2d9c7b748 100644 --- a/__tests__/Scanner.snapshot.tsx +++ b/__tests__/Scanner.snapshot.tsx @@ -7,12 +7,6 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import Scanner from '../components/Components/Scanner'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Scanner - test', () => { diff --git a/__tests__/Seed.snapshot.tsx b/__tests__/Seed.snapshot.tsx index b711a0ff9..4f96f126d 100644 --- a/__tests__/Seed.snapshot.tsx +++ b/__tests__/Seed.snapshot.tsx @@ -18,52 +18,6 @@ import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockWallet } from '../__mocks__/dataMocks/mockWallet'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Seed - test', () => { diff --git a/__tests__/Send.snapshot.tsx b/__tests__/Send.snapshot.tsx index ea5f059d1..14ebe4c96 100644 --- a/__tests__/Send.snapshot.tsx +++ b/__tests__/Send.snapshot.tsx @@ -9,7 +9,6 @@ import { render } from '@testing-library/react-native'; import Send from '../components/Send'; import { defaultAppContextLoaded, ContextAppLoadedProvider } from '../app/context'; import { ModeEnum, CurrencyEnum } from '../app/AppState'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; import { mockValueTransfers } from '../__mocks__/dataMocks/mockValueTransfers'; import { mockAddresses } from '../__mocks__/dataMocks/mockAddresses'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; @@ -18,60 +17,6 @@ import { mockZecPrice } from '../__mocks__/dataMocks/mockZecPrice'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import mockSendPageState from '../__mocks__/dataMocks/mockSendPageState'; -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useScrollToTop: jest.fn(), - useIsFocused: jest.fn(), - useTheme: () => mockTheme, -})); -jest.mock('react-native-picker-select', () => 'RNPickerSelect'); -jest.mock('react-native-device-info', () => ({ - getSystemName: jest.fn(() => 'Mocked System Name'), - getSystemVersion: jest.fn(() => 'Mocked System Version'), - getManufacturer: jest.fn(() => 'Mocked Manufacturer'), - getModel: jest.fn(() => 'Mocked Model'), -})); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); - // test suite describe('Component Send - test', () => { //snapshot test diff --git a/__tests__/Settings.snapshot.tsx b/__tests__/Settings.snapshot.tsx index 009e2af27..1bd284dfc 100644 --- a/__tests__/Settings.snapshot.tsx +++ b/__tests__/Settings.snapshot.tsx @@ -14,76 +14,6 @@ import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockServer } from '../__mocks__/dataMocks/mockServer'; import { mockWalletSettings } from '../__mocks__/dataMocks/mockWalletSettings'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native-picker-select', () => 'RNPickerSelect'); -jest.mock('react-native-keychain', () => ({ - ACCESS_CONTROL: { - BIOMETRY_CURRENT_SET: 'biometryCurrentSet', - }, - ACCESSIBLE: { - WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'whenUnlockedThisDeviceOnly', - }, - AUTHENTICATION_TYPE: { - BIOMETRICS: 'biometrics', - }, - SECURITY_LEVEL: { - SECURE_SOFTWARE: 'secureSoftware', - }, - SECURITY_RULES: { - NONE: 'none', - }, - STORAGE_TYPE: { - AES: 'AES', - }, - setGenericPassword: jest.fn(), - getGenericPassword: jest.fn(), - resetGenericPassword: jest.fn(), - hasGenericPassword: jest.fn(), - getSupportedBiometryType: jest.fn(), -})); -jest.useFakeTimers(); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); -jest.mock('react-native-bouncy-checkbox', () => 'BouncyCheckbox'); // test suite describe('Component Settings - test', () => { diff --git a/__tests__/ShowUfvk.snapshot.tsx b/__tests__/ShowUfvk.snapshot.tsx index 614df915d..a6f2e67a0 100644 --- a/__tests__/ShowUfvk.snapshot.tsx +++ b/__tests__/ShowUfvk.snapshot.tsx @@ -13,52 +13,6 @@ import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import { mockWallet } from '../__mocks__/dataMocks/mockWallet'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', - groupingSeparator: ',', - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component ShowUfvk - test', () => { diff --git a/__tests__/SingleAddress.snapshot.tsx b/__tests__/SingleAddress.snapshot.tsx index 6b25a2a58..e51fa6796 100644 --- a/__tests__/SingleAddress.snapshot.tsx +++ b/__tests__/SingleAddress.snapshot.tsx @@ -8,26 +8,6 @@ import React from 'react'; import { render } from '@testing-library/react-native'; import SingleAddress from '../components/Components/SingleAddress'; import { mockAddresses } from '../__mocks__/dataMocks/mockAddresses'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component SingleAddress - test', () => { diff --git a/__tests__/Snackbars.snapshot.tsx b/__tests__/Snackbars.snapshot.tsx index 949066d93..281f76fa9 100644 --- a/__tests__/Snackbars.snapshot.tsx +++ b/__tests__/Snackbars.snapshot.tsx @@ -9,22 +9,6 @@ import { render } from '@testing-library/react-native'; import Snackbars from '../components/Components/Snackbars'; import { mockTranslate } from '../__mocks__/dataMocks/mockTranslate'; import { mockSnackbars } from '../__mocks__/dataMocks/mockSnackbars'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-snackbar', () => { - return { - LENGTH_LONG: 3500, - show: jest.fn(), - }; -}); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component Snackbars - test', () => { diff --git a/__tests__/SyncReport.snapshot.tsx b/__tests__/SyncReport.snapshot.tsx index 68645d0ce..309a37931 100644 --- a/__tests__/SyncReport.snapshot.tsx +++ b/__tests__/SyncReport.snapshot.tsx @@ -14,67 +14,6 @@ import { mockInfo } from '../__mocks__/dataMocks/mockInfo'; import { mockTotalBalance } from '../__mocks__/dataMocks/mockTotalBalance'; import mockSyncingStatus from '../__mocks__/dataMocks/mockSyncingStatus'; import { mockNetInfo } from '../__mocks__/dataMocks/mockNetInfo'; -import { mockTheme } from '../__mocks__/dataMocks/mockTheme'; - -const NetInfoStateType = { - unknown: 'unknown', - none: 'none', - cellular: 'cellular', - wifi: 'wifi', - bluetooth: 'bluetooth', - ethernet: 'ethernet', - wimax: 'wimax', - vpn: 'vpn', - other: 'other', -}; - -jest.mock('react-native-safe-area-context', () => ({ - SafeAreaProvider: ({ children }: any) => children, - SafeAreaView: ({ children }: any) => children, - useSafeAreaInsets: () => ({ top: 0, left: 0, right: 0, bottom: 0 }), -})); -jest.useFakeTimers(); -jest.mock('@fortawesome/react-native-fontawesome', () => ({ - FontAwesomeIcon: '', -})); -jest.mock('react-native-localize', () => ({ - getNumberFormatSettings: () => { - return { - decimalSeparator: '.', // us - groupingSeparator: ',', // us - }; - }, -})); -jest.mock('react-native/src/private/animated/NativeAnimatedHelper'); -jest.mock('@react-native-community/netinfo/src/index', () => ({ - RNCNetInfo: () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RNCNetInfo = { - execute: jest.fn(() => '{}'), - }; - - return RN; - }, - NetInfoStateType: NetInfoStateType, -})); -jest.mock('react-native', () => { - const RN = jest.requireActual('react-native'); - - RN.NativeModules.RPCModule = { - execute: jest.fn(() => '{}'), - }; - - return RN; -}); -jest.mock('@react-native-clipboard/clipboard', () => ({ - getString: jest.fn(() => Promise.resolve('mocked clipboard content')), - setString: jest.fn(), -})); -jest.mock('@react-navigation/native', () => ({ - ...jest.requireActual('@react-navigation/native'), - useTheme: () => (mockTheme), -})); // test suite describe('Component SyncReport - test', () => { diff --git a/__tests__/__snapshots__/DetailLine.snapshot.tsx.snap b/__tests__/__snapshots__/DetailLine.snapshot.tsx.snap index 880e13b51..3cd3be0dd 100644 --- a/__tests__/__snapshots__/DetailLine.snapshot.tsx.snap +++ b/__tests__/__snapshots__/DetailLine.snapshot.tsx.snap @@ -19,7 +19,18 @@ exports[`Component DetailLine - test DetailLine children - snapshot 1`] = ` > label - + + Hello + `; diff --git a/__tests__/__snapshots__/Scanner.snapshot.tsx.snap b/__tests__/__snapshots__/Scanner.snapshot.tsx.snap index fd1d370b6..256e7cdf1 100644 --- a/__tests__/__snapshots__/Scanner.snapshot.tsx.snap +++ b/__tests__/__snapshots__/Scanner.snapshot.tsx.snap @@ -1,15 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`Component Scanner - test Scanner - snapshot 1`] = ` - -`; +exports[`Component Scanner - test Scanner - snapshot 1`] = `null`; diff --git a/__tests__/__snapshots__/Settings.snapshot.tsx.snap b/__tests__/__snapshots__/Settings.snapshot.tsx.snap index 03f801560..0e8a4fb68 100644 --- a/__tests__/__snapshots__/Settings.snapshot.tsx.snap +++ b/__tests__/__snapshots__/Settings.snapshot.tsx.snap @@ -1909,135 +1909,7 @@ exports[`Component Settings - test Settings - snapshot 1`] = ` - - - < - color="#ffffff" - icon={ - { - "icon": [ - 512, - 512, - [ - 128308, - 128309, - 128992, - 128993, - 128994, - 128995, - 128996, - 9679, - 9898, - 9899, - 11044, - 61708, - 61915, - ], - "f111", - "M464 256A208 208 0 1 0 48 256a208 208 0 1 0 416 0zM0 256a256 256 0 1 1 512 0A256 256 0 1 1 0 256z", - ], - "iconName": "circle", - "prefix": "far", - } - } - size={20} - /> - - text translated - - - + RNPickerSelect - + BouncyCheckbox - + BouncyCheckbox - + BouncyCheckbox - + BouncyCheckbox - + BouncyCheckbox - + BouncyCheckbox - + BouncyCheckbox - + BouncyCheckbox ; - const fnTabBarIcon = (route: StackScreenProps['route'], focused: boolean) => { var iconName; @@ -1877,7 +1874,7 @@ export class LoadedAppClass extends Component - + {({ navigation }: { navigation: DrawerContentComponentProps['navigation'] }) => ( <> diff --git a/app/recoveryWalletInfo.ts b/app/recoveryWalletInfo.ts index 4a42721d1..849eb5ad3 100644 --- a/app/recoveryWalletInfo.ts +++ b/app/recoveryWalletInfo.ts @@ -26,7 +26,7 @@ export const saveRecoveryWalletInfo = async (keys: WalletType): Promise => JSON.stringify(keys), options(await Keychain.getSupportedBiometryType()), ); - console.log('keys saved correctly'); + //console.log('keys saved correctly'); //console.log('key:', GlobalConst.keyKeyChain); //console.log('value:', keys); } catch (error) { @@ -38,8 +38,8 @@ export const getRecoveryWalletInfo = async (): Promise => { try { const credentials = await Keychain.getGenericPassword(options(await Keychain.getSupportedBiometryType())); if (credentials) { - console.log('keys read correctly', credentials); - console.log('biometrics', await Keychain.getSupportedBiometryType()); + //console.log('keys read correctly', credentials); + //console.log('biometrics', await Keychain.getSupportedBiometryType()); //console.log('key:', credentials.username); //console.log('value:', credentials.password); if (credentials.username === GlobalConst.keyKeyChain && credentials.service === GlobalConst.serviceKeyChain) { @@ -63,7 +63,7 @@ export const hasRecoveryWalletInfo = async (): Promise => { export const createUpdateRecoveryWalletInfo = async (keys: WalletType): Promise => { // have not Wallet Keys - console.log('creating keys'); + //console.log('creating keys'); await saveRecoveryWalletInfo(keys); }; diff --git a/components/Drawer/Drawer.tsx b/components/Drawer/Drawer.tsx index 6cf60e8dd..db57634ec 100644 --- a/components/Drawer/Drawer.tsx +++ b/components/Drawer/Drawer.tsx @@ -1,7 +1,11 @@ import { createDrawerNavigator, DrawerContentComponentProps } from '@react-navigation/drawer'; import React from 'react'; +import Menu from './components/Menu'; +import { MenuItemEnum } from '../../app/AppState'; +import { HideReturn } from 'react-native-magic-modal'; type DrawerProps = { + onMenuItemSelected: (i: MenuItemEnum) => Promise | undefined>; initialRouteName: string; children: any; drawerContent?: (props: DrawerContentComponentProps) => React.ReactNode; @@ -26,10 +30,12 @@ const SideBar = createDrawerNavigator(); * * } */ -function Drawer({ initialRouteName, drawerContent, children }: DrawerProps) { +function Drawer({ onMenuItemSelected, initialRouteName, children }: DrawerProps) { + const menu = (props: DrawerContentComponentProps) => ; + return (