-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #611 from juanky201271/dev_pin_based_and_address_book
PIN based and address book for testing
- Loading branch information
Showing
65 changed files
with
4,756 additions
and
628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
import 'react-native'; | ||
import React from 'react'; | ||
|
||
import { render } from '@testing-library/react-native'; | ||
import { defaultAppStateLoaded, ContextAppLoadedProvider } from '../app/context'; | ||
import { ThemeType } from '../app/types'; | ||
import AbDetail from '../components/AddressBook/components/AbDetail'; | ||
import { AddressBookFileClass } from '../app/AppState'; | ||
|
||
jest.useFakeTimers(); | ||
jest.mock('@fortawesome/react-native-fontawesome', () => ({ | ||
FontAwesomeIcon: '', | ||
})); | ||
jest.mock('react-native-localize', () => ({ | ||
getNumberFormatSettings: () => { | ||
return { | ||
decimalSeparator: '.', // us | ||
groupingSeparator: ',', // us | ||
}; | ||
}, | ||
})); | ||
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper'); | ||
jest.mock('react-native-reanimated', () => { | ||
return class Reanimated { | ||
public static Value() { | ||
return jest.fn(() => {}); | ||
} | ||
public static View() { | ||
return ''; | ||
} | ||
}; | ||
}); | ||
jest.mock('@react-native-community/netinfo', () => { | ||
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; | ||
}); | ||
const Theme: ThemeType = { | ||
dark: true, | ||
colors: { | ||
background: '#011401', //'#010101', | ||
card: '#011401', //'#401717', | ||
border: '#ffffff', | ||
primary: '#18bd18', //'#df4100', | ||
primaryDisabled: '#5a8c5a', //'rgba(90, 140, 90, 1)', | ||
secondaryDisabled: '#233623', | ||
text: '#c3c3c3', | ||
zingo: '#888888', | ||
placeholder: '#888888', | ||
money: '#ffffff', | ||
syncing: '#ebff5a', | ||
notification: '', | ||
}, | ||
}; | ||
jest.mock('@react-navigation/native', () => ({ | ||
useScrollToTop: jest.fn(), | ||
useTheme: () => Theme, | ||
})); | ||
|
||
// test suite | ||
describe('Component Address Book Details - test', () => { | ||
//snapshot test | ||
const state = defaultAppStateLoaded; | ||
state.addressBook = [ | ||
{ | ||
label: 'pepe', | ||
address: 'u1234567890_____________', | ||
}, | ||
{ | ||
label: 'lolo', | ||
address: 'u0987654321_____________', | ||
}, | ||
]; | ||
state.translate = () => 'translated text'; | ||
const onCancel = jest.fn(); | ||
const onAction = jest.fn(); | ||
test('Address Book Datails - Add - snapshot', () => { | ||
const ab: any = render( | ||
<ContextAppLoadedProvider value={state}> | ||
<AbDetail index={-1} item={{} as AddressBookFileClass} cancel={onCancel} action={'Add'} doAction={onAction} /> | ||
</ContextAppLoadedProvider>, | ||
); | ||
expect(ab.toJSON()).toMatchSnapshot(); | ||
}); | ||
test('Address Book Datails - Modify - snapshot', () => { | ||
const ab: any = render( | ||
<ContextAppLoadedProvider value={state}> | ||
<AbDetail index={0} item={state.addressBook[0]} cancel={onCancel} action={'Modify'} doAction={onAction} /> | ||
</ContextAppLoadedProvider>, | ||
); | ||
expect(ab.toJSON()).toMatchSnapshot(); | ||
}); | ||
test('Address Book Datails - Delete - snapshot', () => { | ||
const ab: any = render( | ||
<ContextAppLoadedProvider value={state}> | ||
<AbDetail index={1} item={state.addressBook[1]} cancel={onCancel} action={'Delete'} doAction={onAction} /> | ||
</ContextAppLoadedProvider>, | ||
); | ||
expect(ab.toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
import 'react-native'; | ||
import React from 'react'; | ||
|
||
import { render } from '@testing-library/react-native'; | ||
import { defaultAppStateLoaded, ContextAppLoadedProvider } from '../app/context'; | ||
import AddressBook from '../components/AddressBook/AddressBook'; | ||
import { ThemeType } from '../app/types'; | ||
|
||
jest.useFakeTimers(); | ||
jest.mock('@fortawesome/react-native-fontawesome', () => ({ | ||
FontAwesomeIcon: '', | ||
})); | ||
jest.mock('react-native-localize', () => ({ | ||
getNumberFormatSettings: () => { | ||
return { | ||
decimalSeparator: '.', // us | ||
groupingSeparator: ',', // us | ||
}; | ||
}, | ||
})); | ||
jest.mock('react-native/Libraries/Animated/NativeAnimatedHelper'); | ||
jest.mock('react-native-reanimated', () => { | ||
return class Reanimated { | ||
public static Value() { | ||
return jest.fn(() => {}); | ||
} | ||
public static View() { | ||
return ''; | ||
} | ||
}; | ||
}); | ||
jest.mock('@react-native-community/netinfo', () => { | ||
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; | ||
}); | ||
const Theme: ThemeType = { | ||
dark: true, | ||
colors: { | ||
background: '#011401', //'#010101', | ||
card: '#011401', //'#401717', | ||
border: '#ffffff', | ||
primary: '#18bd18', //'#df4100', | ||
primaryDisabled: '#5a8c5a', //'rgba(90, 140, 90, 1)', | ||
secondaryDisabled: '#233623', | ||
text: '#c3c3c3', | ||
zingo: '#888888', | ||
placeholder: '#888888', | ||
money: '#ffffff', | ||
syncing: '#ebff5a', | ||
notification: '', | ||
}, | ||
}; | ||
jest.mock('@react-navigation/native', () => ({ | ||
useScrollToTop: jest.fn(), | ||
useTheme: () => Theme, | ||
})); | ||
|
||
// test suite | ||
describe('Component Address Book - test', () => { | ||
//snapshot test | ||
test('Address Book - snapshot', () => { | ||
const state = defaultAppStateLoaded; | ||
state.addressBook = [ | ||
{ | ||
label: 'pepe', | ||
address: 'u1234567890_____________', | ||
}, | ||
{ | ||
label: 'lolo', | ||
address: 'u0987654321_____________', | ||
}, | ||
]; | ||
state.translate = () => 'translated text'; | ||
const onClose = jest.fn(); | ||
const onSet = jest.fn(); | ||
const ab: any = render( | ||
<ContextAppLoadedProvider value={state}> | ||
<AddressBook closeModal={onClose} setAddressBook={onSet} setSendPageState={onSet} /> | ||
</ContextAppLoadedProvider>, | ||
); | ||
expect(ab.toJSON()).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.