format import React from 'react' ; import { View } from 'react-native' ; import { ErrorBoundary } from '@components' ; import renderer from 'react-test-renderer' ; import { shallow } from 'enzyme' ; it ( 'renders correctly' , ( ) => { const instance = renderer . create ( < ErrorBoundary > < View /> < /ErrorBoundary>); expect ( instance . toJSON ( ) ) . toMatchSnapshot ( ) ; } ) ; it ( 'renders errors' , ( ) => { const instance = shallow ( < ErrorBoundary > < View /> < /ErrorBoundary>); instance . setState ( { hasError : true } ) ; expect ( instance . childAt ( 0 ) . text ( ) ) . toBe ( 'Error Fallback' ) ; } ) ;