@yoroi/common
Version:
The Common package of Yoroi SDK
23 lines (22 loc) • 786 B
JavaScript
;
import { render, waitFor } from '@testing-library/react-native';
import * as React from 'react';
import { ErrorBoundary } from './ErrorBoundary';
import { jsx as _jsx } from "react/jsx-runtime";
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__*/_jsx(ErrorBoundary, {
children: /*#__PURE__*/_jsx(ProblematicChild, {})
}));
await waitFor(() => {
expect(getByTestId('hasError')).toBeDefined();
});
expect(getByTestId('hasError').props.children[0].props.children).toEqual('hasError');
});
});
//# sourceMappingURL=ErrorBoundary.test.js.map