eventOrGroupExtraDetails.spec.jsx 3.3 KB

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