import React from 'react'; const {mountWithIntl} = require('../../helpers/intl-helpers.jsx'); import CrashMessageComponent from '../../../src/components/crashmessage/crashmessage.jsx'; import ErrorBoundary from '../../../src/components/errorboundary/errorboundary.jsx'; const ChildComponent = () =>
hello
; describe('ErrorBoundary', () => { test('ErrorBoundary shows children before error and CrashMessageComponent after', () => { const child = ; const wrapper = mountWithIntl({child}); const childWrapper = wrapper.childAt(0); expect(wrapper.containsMatchingElement(child)).toBeTruthy(); expect(wrapper.containsMatchingElement()).toBeFalsy(); childWrapper.simulateError(new Error('fake error for testing purposes')); expect(wrapper.containsMatchingElement(child)).toBeFalsy(); expect(wrapper.containsMatchingElement()).toBeTruthy(); }); });