routeError.spec.jsx 725 B

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