detailedError.spec.jsx 1.1 KB

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