document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import \'react-native\'
  2. import React from \'react\'
  3. import Adapter from \'enzyme-adapter-react-16\'
  4. import {shallow, configure} from \'enzyme\'
  5. import renderer from \'react-test-renderer\'
  6. import App from \'../src/App\'
  7. configure({adapter: new Adapter(), disableLifecycleMethods: true})
  8.  
  9. const profileWrapper = shallow(<App />)
  10.  
  11. jest.mock(\'@react-navigation/native\', () => ({
  12.   useNavigation: component => component,
  13. }))
  14.  
  15. jest.mock(\'react-native/Libraries/Animated/src/NativeAnimatedHelper\')
  16. jest.mock(\'native-base\')
  17.  
  18. describe(\'App Screen\', () => {
  19.   it(\'should renders correctly\', () => {
  20.     renderer.create(<App />)
  21.   })
  22.  
  23.   it(\'should renders `App Screen` module correctly\', () => {
  24.     expect(profileWrapper).toMatchSnapshot()
  25.   })
  26.  
  27.   describe(\'Check component\', () => {
  28.     it(\'should create find `TextInput`\', () => {
  29.       expect(profileWrapper.find(\'TextInput\').exists())
  30.     })
  31.  
  32.     it(\'should create `TouchableOpacity` component\', () => {
  33.       expect(profileWrapper.find(\'TouchableOpacity\').exists())
  34.     })
  35.  
  36.     describe(\'Mount component\', () => {
  37.       describe(\'Event Test\', () => {
  38.         it(\'should change text when `Input` Change\', () => {
  39.           const mockCallBack = jest.fn()
  40.           profileWrapper.find(\'[testID="input-name"]\').simulate(\'change\')
  41.           expect(mockCallBack.mock.calls.length)
  42.         })
  43.  
  44.         it(\'should click when `Absen` Pressed\', () => {
  45.           const mockCallBack = jest.fn()
  46.           profileWrapper.find(\'[testID="button-absen"]\').simulate(\'press\')
  47.           expect(mockCallBack.mock.calls.length)
  48.         })
  49.       })
  50.     })
  51.   })
  52. })
');