eventOrGroupTitle.spec.jsx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React from 'react';
  2. import {shallow} from 'enzyme';
  3. import toJson from 'enzyme-to-json';
  4. import EventOrGroupTitle from 'app/components/eventOrGroupTitle';
  5. describe('EventOrGroupTitle', function() {
  6. const data = {
  7. metadata: {
  8. title: 'metadata title',
  9. type: 'metadata type',
  10. directive: 'metadata directive',
  11. uri: 'metadata uri',
  12. },
  13. culprit: 'culprit',
  14. };
  15. it('renders with subtitle when `type = error`', function() {
  16. let component = shallow(
  17. <EventOrGroupTitle
  18. data={{
  19. ...data,
  20. ...{
  21. type: 'error',
  22. },
  23. }}
  24. />
  25. );
  26. expect(toJson(component)).toMatchSnapshot();
  27. });
  28. it('renders with subtitle when `type = csp`', function() {
  29. let component = shallow(
  30. <EventOrGroupTitle
  31. data={{
  32. ...data,
  33. ...{
  34. type: 'csp',
  35. },
  36. }}
  37. />
  38. );
  39. expect(toJson(component)).toMatchSnapshot();
  40. });
  41. it('renders with no subtitle when `type = default`', function() {
  42. let component = shallow(
  43. <EventOrGroupTitle
  44. data={{
  45. ...data,
  46. ...{
  47. type: 'default',
  48. },
  49. }}
  50. />
  51. );
  52. expect(toJson(component)).toMatchSnapshot();
  53. });
  54. });