eventOrGroupExtraDetails.spec.tsx 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render} from 'sentry-test/reactTestingLibrary';
  3. import EventOrGroupExtraDetails from 'sentry/components/eventOrGroupExtraDetails';
  4. import {Group} from 'sentry/types';
  5. describe('EventOrGroupExtraDetails', function () {
  6. const {routerContext} = initializeOrg();
  7. it('renders last and first seen', function () {
  8. const {container} = render(
  9. <EventOrGroupExtraDetails
  10. data={
  11. {
  12. project: {id: 'projectId'},
  13. id: 'groupId',
  14. lastSeen: '2017-07-25T22:56:12Z',
  15. firstSeen: '2017-07-01T02:06:02Z',
  16. } as Group
  17. }
  18. />,
  19. {context: routerContext}
  20. );
  21. expect(container).toSnapshot();
  22. });
  23. it('renders only first seen', function () {
  24. const {container} = render(
  25. <EventOrGroupExtraDetails
  26. data={
  27. {
  28. project: {id: 'projectId'},
  29. id: 'groupId',
  30. firstSeen: '2017-07-01T02:06:02Z',
  31. } as Group
  32. }
  33. />,
  34. {context: routerContext}
  35. );
  36. expect(container).toSnapshot();
  37. });
  38. it('renders only last seen', function () {
  39. const {container} = render(
  40. <EventOrGroupExtraDetails
  41. data={
  42. {
  43. project: {id: 'projectId'},
  44. id: 'groupId',
  45. lastSeen: '2017-07-25T22:56:12Z',
  46. } as Group
  47. }
  48. />,
  49. {context: routerContext}
  50. );
  51. expect(container).toSnapshot();
  52. });
  53. it('renders all details', function () {
  54. const {container} = render(
  55. <EventOrGroupExtraDetails
  56. data={
  57. {
  58. id: 'groupId',
  59. lastSeen: '2017-07-25T22:56:12Z',
  60. firstSeen: '2017-07-01T02:06:02Z',
  61. numComments: 14,
  62. shortId: 'shortId',
  63. logger: 'javascript logger',
  64. annotations: ['annotation1', 'annotation2'],
  65. assignedTo: {
  66. name: 'Assignee Name',
  67. },
  68. status: 'resolved',
  69. } as Group
  70. }
  71. />,
  72. {context: routerContext}
  73. );
  74. expect(container).toSnapshot();
  75. });
  76. it('renders assignee and status', function () {
  77. const {container} = render(
  78. <EventOrGroupExtraDetails
  79. data={
  80. {
  81. id: 'groupId',
  82. lastSeen: '2017-07-25T22:56:12Z',
  83. firstSeen: '2017-07-01T02:06:02Z',
  84. numComments: 14,
  85. shortId: 'shortId',
  86. logger: 'javascript logger',
  87. annotations: ['annotation1', 'annotation2'],
  88. assignedTo: {
  89. name: 'Assignee Name',
  90. },
  91. status: 'resolved',
  92. } as Group
  93. }
  94. showAssignee
  95. />,
  96. {context: routerContext}
  97. );
  98. expect(container).toSnapshot();
  99. });
  100. it('details when mentioned', function () {
  101. const {container} = render(
  102. <EventOrGroupExtraDetails
  103. data={
  104. {
  105. id: 'groupId',
  106. lastSeen: '2017-07-25T22:56:12Z',
  107. firstSeen: '2017-07-01T02:06:02Z',
  108. numComments: 14,
  109. shortId: 'shortId',
  110. logger: 'javascript logger',
  111. annotations: ['annotation1', 'annotation2'],
  112. subscriptionDetails: {reason: 'mentioned'},
  113. } as Group
  114. }
  115. />,
  116. {context: routerContext}
  117. );
  118. expect(container).toSnapshot();
  119. });
  120. });