diff --git a/src/components/SentryBoundary/__snapshots__/test.js.snap b/src/components/SentryBoundary/__snapshots__/test.js.snap index 330b19e..7386a44 100644 --- a/src/components/SentryBoundary/__snapshots__/test.js.snap +++ b/src/components/SentryBoundary/__snapshots__/test.js.snap @@ -9,7 +9,7 @@ exports[`SentryBoundary error handling 1`] = ` exports[`SentryBoundary error handling 2`] = ` diff --git a/src/components/SentryError/index.js b/src/components/SentryError/index.js index e0c1d94..a1fe62d 100644 --- a/src/components/SentryError/index.js +++ b/src/components/SentryError/index.js @@ -1,7 +1,6 @@ import React from 'react'; -import PropTypes from 'prop-types'; import * as Sentry from '@sentry/browser'; -import { withTranslation, Trans } from 'react-i18next'; +import { useTranslation, Trans } from 'react-i18next'; import Message from 'components/Message'; @@ -13,19 +12,17 @@ const reportError = event => { } }; -export const SentryError = ({ t }) => ( - +export const SentryError = () => { + const { t } = useTranslation(); + + return This error has been logged. You may also fill out a report. - -); - -SentryError.propTypes = { - t: PropTypes.func.isRequired + ; }; -export default withTranslation()(SentryError); +export default SentryError; diff --git a/src/components/SentryError/test.js b/src/components/SentryError/test.js index dfb1641..e162fb8 100644 --- a/src/components/SentryError/test.js +++ b/src/components/SentryError/test.js @@ -7,13 +7,12 @@ import React from 'react'; import { render, fireEvent } from 'react-testing-library'; import * as Sentry from '@sentry/browser'; -import { mockT } from 'i18n'; -import { SentryError } from 'components/SentryError'; +import SentryError from 'components/SentryError'; describe('SentryError', () => { test('rendering', () => { const { asFragment } = render( - + ); expect(asFragment()).toMatchSnapshot(); }); @@ -22,7 +21,7 @@ describe('SentryError', () => { test('fill out a report when an event has been logged', () => { Sentry.lastEventId.mockReturnValue(1); const { getByTestId } = render( - + ); const event = new MouseEvent('click', { bubbles: true }); jest.spyOn(event, 'preventDefault'); @@ -35,7 +34,7 @@ describe('SentryError', () => { test('fill out a report when an event has not been logged', () => { Sentry.lastEventId.mockReturnValue(false); const { getByTestId } = render( - + ); const event = new MouseEvent('click', { bubbles: true }); jest.spyOn(event, 'preventDefault');
This error has been logged. You may also fill out a report.