eventExtraData.spec.tsx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  2. import EventExtraData from 'sentry/components/events/eventExtraData';
  3. describe('EventExtraData', function () {
  4. it('display redacted data', async function () {
  5. const event = {
  6. ...TestStubs.Event(),
  7. context: {
  8. 'sys.argv': ['', '', '', '', '', '', '', '', '', ''],
  9. sdk: {
  10. clientIP: '127.0.0.1',
  11. version: '3.16.1',
  12. name: 'raven-js',
  13. upstream: {
  14. url: 'https://docs.sentry.io/clients/javascript/',
  15. isNewer: '\n',
  16. },
  17. },
  18. },
  19. _meta: {
  20. context: {
  21. 'sys.argv': {
  22. '0': {
  23. '': {
  24. rem: [['project:3', 's', 0, 0]],
  25. len: 49,
  26. chunks: [
  27. {
  28. type: 'redaction',
  29. text: '',
  30. rule_id: 'project:3',
  31. remark: 's',
  32. },
  33. ],
  34. },
  35. },
  36. '1': {
  37. '': {
  38. rem: [['project:3', 's', 0, 0]],
  39. len: 17,
  40. chunks: [
  41. {
  42. type: 'redaction',
  43. text: '',
  44. rule_id: 'project:3',
  45. remark: 's',
  46. },
  47. ],
  48. },
  49. },
  50. '2': {
  51. '': {
  52. rem: [['project:3', 's', 0, 0]],
  53. len: 12,
  54. chunks: [
  55. {
  56. type: 'redaction',
  57. text: '',
  58. rule_id: 'project:3',
  59. remark: 's',
  60. },
  61. ],
  62. },
  63. },
  64. '3': {
  65. '': {
  66. rem: [['project:3', 's', 0, 0]],
  67. len: 8,
  68. chunks: [
  69. {
  70. type: 'redaction',
  71. text: '',
  72. rule_id: 'project:3',
  73. remark: 's',
  74. },
  75. ],
  76. },
  77. },
  78. '4': {
  79. '': {
  80. rem: [['project:3', 's', 0, 0]],
  81. len: 30,
  82. chunks: [
  83. {
  84. type: 'redaction',
  85. text: '',
  86. rule_id: 'project:3',
  87. remark: 's',
  88. },
  89. ],
  90. },
  91. },
  92. '5': {
  93. '': {
  94. rem: [['project:3', 's', 0, 0]],
  95. len: 8,
  96. chunks: [
  97. {
  98. type: 'redaction',
  99. text: '',
  100. rule_id: 'project:3',
  101. remark: 's',
  102. },
  103. ],
  104. },
  105. },
  106. '6': {
  107. '': {
  108. rem: [['project:3', 's', 0, 0]],
  109. len: 18,
  110. chunks: [
  111. {
  112. type: 'redaction',
  113. text: '',
  114. rule_id: 'project:3',
  115. remark: 's',
  116. },
  117. ],
  118. },
  119. },
  120. '7': {
  121. '': {
  122. rem: [['project:3', 's', 0, 0]],
  123. len: 8,
  124. chunks: [
  125. {
  126. type: 'redaction',
  127. text: '',
  128. rule_id: 'project:3',
  129. remark: 's',
  130. },
  131. ],
  132. },
  133. },
  134. '8': {
  135. '': {
  136. rem: [['project:3', 's', 0, 0]],
  137. len: 26,
  138. chunks: [
  139. {
  140. type: 'redaction',
  141. text: '',
  142. rule_id: 'project:3',
  143. remark: 's',
  144. },
  145. ],
  146. },
  147. },
  148. '9': {
  149. '': {
  150. rem: [['project:3', 's', 0, 0]],
  151. len: 8,
  152. chunks: [
  153. {
  154. type: 'redaction',
  155. text: '',
  156. rule_id: 'project:3',
  157. remark: 's',
  158. },
  159. ],
  160. },
  161. },
  162. '': {
  163. len: 14,
  164. },
  165. },
  166. },
  167. },
  168. };
  169. render(<EventExtraData event={event} />);
  170. expect(screen.getAllByText(/redacted/)).toHaveLength(10);
  171. userEvent.hover(screen.getAllByText(/redacted/)[0]);
  172. expect(
  173. await screen.findByText('Replaced because of PII rule "project:3"')
  174. ).toBeInTheDocument(); // tooltip description
  175. expect(screen.getByText('isNewer')).toBeInTheDocument(); // key
  176. expect(screen.queryByText('\\n')).not.toBeInTheDocument(); // value
  177. });
  178. });