eventOrGroupExtraDetails.spec.jsx 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. import React from 'react';
  2. import {shallow} from 'sentry-test/enzyme';
  3. import toJson from 'enzyme-to-json';
  4. import EventOrGroupExtraDetails from 'app/components/eventOrGroupExtraDetails';
  5. describe('EventOrGroupExtraDetails', function() {
  6. it('renders last and first seen', function() {
  7. const component = shallow(
  8. <EventOrGroupExtraDetails
  9. orgId="orgId"
  10. projectId="projectId"
  11. groupId="groupId"
  12. lastSeen="2017-07-25T22:56:12Z"
  13. firstSeen="2017-07-01T02:06:02Z"
  14. />
  15. );
  16. expect(toJson(component)).toMatchSnapshot();
  17. });
  18. it('renders only first seen', function() {
  19. const component = shallow(
  20. <EventOrGroupExtraDetails
  21. orgId="orgId"
  22. projectId="projectId"
  23. groupId="groupId"
  24. firstSeen="2017-07-01T02:06:02Z"
  25. />
  26. );
  27. expect(toJson(component)).toMatchSnapshot();
  28. });
  29. it('renders only last seen', function() {
  30. const component = shallow(
  31. <EventOrGroupExtraDetails
  32. orgId="orgId"
  33. projectId="projectId"
  34. groupId="groupId"
  35. lastSeen="2017-07-25T22:56:12Z"
  36. />
  37. );
  38. expect(toJson(component)).toMatchSnapshot();
  39. });
  40. it('renders all details', function() {
  41. const component = shallow(
  42. <EventOrGroupExtraDetails
  43. orgId="orgId"
  44. projectId="projectId"
  45. groupId="groupId"
  46. lastSeen="2017-07-25T22:56:12Z"
  47. firstSeen="2017-07-01T02:06:02Z"
  48. numComments={14}
  49. shortId="shortId"
  50. logger="javascript logger"
  51. annotations={['annotation1', 'annotation2']}
  52. assignedTo={{
  53. name: 'Assignee Name',
  54. }}
  55. status="resolved"
  56. />
  57. );
  58. expect(toJson(component)).toMatchSnapshot();
  59. });
  60. it('renders assignee and status', function() {
  61. const component = shallow(
  62. <EventOrGroupExtraDetails
  63. orgId="orgId"
  64. projectId="projectId"
  65. groupId="groupId"
  66. lastSeen="2017-07-25T22:56:12Z"
  67. firstSeen="2017-07-01T02:06:02Z"
  68. numComments={14}
  69. shortId="shortId"
  70. logger="javascript logger"
  71. annotations={['annotation1', 'annotation2']}
  72. assignedTo={{
  73. name: 'Assignee Name',
  74. }}
  75. status="resolved"
  76. showAssignee
  77. showStatus
  78. />
  79. );
  80. expect(toJson(component)).toMatchSnapshot();
  81. });
  82. it('details when mentioned', function() {
  83. const component = shallow(
  84. <EventOrGroupExtraDetails
  85. orgId="orgId"
  86. projectId="projectId"
  87. groupId="groupId"
  88. lastSeen="2017-07-25T22:56:12Z"
  89. firstSeen="2017-07-01T02:06:02Z"
  90. numComments={14}
  91. shortId="shortId"
  92. logger="javascript logger"
  93. annotations={['annotation1', 'annotation2']}
  94. subscriptionDetails={{reason: 'mentioned'}}
  95. />
  96. );
  97. expect(toJson(component)).toMatchSnapshot();
  98. });
  99. });