routeError.spec.jsx 818 B

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