UNPKG

@yoroi/common

Version:

The Common package of Yoroi SDK

18 lines 732 B
import React from 'react'; import { render, waitFor } from '@testing-library/react-native'; import { ErrorBoundary } from './ErrorBoundary'; const ProblematicChild = () => { throw new Error('Test error'); }; describe('ErrorBoundary', () => { test('should display an error message when a child component throws an error', async () => { const { getByTestId } = render( /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(ProblematicChild, null))); await waitFor(() => { expect(getByTestId('hasError')).toBeDefined(); }); expect(getByTestId('hasError').props.children[0].props.children).toEqual('hasError'); }); }); //# sourceMappingURL=ErrorBoundary.test.js.map