More realistic faking of setState to improve coverage

This commit is contained in:
Jeff Avallone 2019-01-06 16:42:14 -05:00
parent 02f6f2d252
commit ba8461c281

View File

@ -29,7 +29,7 @@ describe('SentryBoundary', () => {
component.find('Child').simulateError(error); component.find('Child').simulateError(error);
// NOTE: Enzyme doesn't call getDerivedStateFromError yet, so we have to // NOTE: Enzyme doesn't call getDerivedStateFromError yet, so we have to
// set the state manually // set the state manually
component.setState({ hasError: true }); component.setState(SentryBoundary.getDerivedStateFromError(error));
expect(Sentry.captureException).toHaveBeenCalledWith( expect(Sentry.captureException).toHaveBeenCalledWith(
error, error,