routeError.spec.jsx 807 B

12345678910111213141516171819202122232425262728293031
  1. import * as Sentry from '@sentry/react';
  2. import {mountWithTheme} from 'sentry-test/enzyme';
  3. import {RouteError} from 'app/views/routeError';
  4. describe('RouteError', function () {
  5. afterEach(function () {
  6. Sentry.captureException.mockClear();
  7. Sentry.showReportDialog.mockClear();
  8. });
  9. it('captures errors with raven', async function () {
  10. const error = new Error('Big Bad Error');
  11. const routes = TestStubs.routes();
  12. mountWithTheme(
  13. <RouteError routes={routes} error={error} />,
  14. TestStubs.routerContext()
  15. );
  16. await tick();
  17. expect(Sentry.captureException).toHaveBeenCalledWith(
  18. expect.objectContaining({
  19. message: 'Big Bad Error: /organizations/:orgId/api-keys/',
  20. })
  21. );
  22. expect(Sentry.showReportDialog).toHaveBeenCalled();
  23. });
  24. });