errorItem.spec.tsx 1.8 KB

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