errorItem.spec.tsx 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  2. import {ErrorItem} from 'sentry/components/events/errorItem';
  3. describe('Issue error item', function () {
  4. it('expand subitems', function () {
  5. render(
  6. <ErrorItem
  7. error={{
  8. data: {
  9. mapping_uuid: 'd270a1a0-1970-3c05-cb09-2cb00b4335ee',
  10. },
  11. type: 'proguard_missing_mapping',
  12. message: 'A proguard mapping file was missing.',
  13. }}
  14. />
  15. );
  16. expect(screen.getByText('A proguard mapping file was missing.')).toBeInTheDocument();
  17. expect(screen.queryByText('Mapping Uuid')).not.toBeInTheDocument();
  18. userEvent.click(screen.getByLabelText('Expand'));
  19. expect(screen.getByText('Mapping Uuid')).toBeInTheDocument();
  20. });
  21. it('display redacted data', async function () {
  22. render(
  23. <ErrorItem
  24. error={{
  25. data: {
  26. image_path: '',
  27. image_uuid: '6b77ffb6-5aba-3b5f-9171-434f9660f738',
  28. message: '',
  29. },
  30. message: 'A required debug information file was missing.',
  31. type: 'native_missing_dsym',
  32. }}
  33. meta={{
  34. image_path: {'': {rem: [['project:2', 's', 0, 0]], len: 117}},
  35. }}
  36. />
  37. );
  38. userEvent.click(screen.getByLabelText('Expand'));
  39. expect(screen.getByText('File Name')).toBeInTheDocument();
  40. expect(screen.getByText('File Path')).toBeInTheDocument();
  41. expect(screen.getAllByText(/redacted/)).toHaveLength(2);
  42. userEvent.hover(screen.getAllByText(/redacted/)[0]);
  43. expect(
  44. await screen.findByText('Replaced because of PII rule "project:2"')
  45. ).toBeInTheDocument(); // tooltip description
  46. });
  47. });