UNPKG

@yoroi/common

Version:

The Common package of Yoroi SDK

21 lines (20 loc) 936 B
"use strict"; var _react = _interopRequireDefault(require("react")); var _reactNative = require("@testing-library/react-native"); var _ErrorBoundary = require("./ErrorBoundary"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 } = (0, _reactNative.render)( /*#__PURE__*/_react.default.createElement(_ErrorBoundary.ErrorBoundary, null, /*#__PURE__*/_react.default.createElement(ProblematicChild, null))); await (0, _reactNative.waitFor)(() => { expect(getByTestId('hasError')).toBeDefined(); }); expect(getByTestId('hasError').props.children[0].props.children).toEqual('hasError'); }); }); //# sourceMappingURL=ErrorBoundary.test.js.map