detailedError.spec.jsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import React from 'react';
  2. import {mountWithTheme} from 'sentry-test/enzyme';
  3. import DetailedError from 'app/components/errors/detailedError';
  4. describe('DetailedError', function () {
  5. it('renders', function () {
  6. const wrapper = mountWithTheme(
  7. <DetailedError heading="Error heading" message={<div>Message</div>} />
  8. );
  9. expect(wrapper).toSnapshot();
  10. });
  11. it('renders with "Retry" button', function () {
  12. const wrapper = mountWithTheme(
  13. <DetailedError
  14. onRetry={() => {}}
  15. heading="Error heading"
  16. message={<div>Message</div>}
  17. />
  18. );
  19. expect(wrapper).toSnapshot();
  20. });
  21. it('can hide support links', function () {
  22. const wrapper = mountWithTheme(
  23. <DetailedError
  24. hideSupportLinks
  25. onRetry={() => {}}
  26. heading="Error heading"
  27. message={<div>Message</div>}
  28. />
  29. );
  30. expect(wrapper).toSnapshot();
  31. });
  32. it('hides footer when no "Retry" and no support links', function () {
  33. const wrapper = mountWithTheme(
  34. <DetailedError
  35. hideSupportLinks
  36. heading="Error heading"
  37. message={<div>Message</div>}
  38. />
  39. );
  40. expect(wrapper).toSnapshot();
  41. });
  42. });