index.spec.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  2. import {AppEventContext} from 'sentry/components/events/contexts/app';
  3. import {AppData} from 'sentry/components/events/contexts/app/types';
  4. export const appMockData: AppData = {
  5. device_app_hash: '2421fae1ac9237a8131e74883e52b0f7034a143f',
  6. build_type: 'test',
  7. app_identifier: 'io.sentry.sample.iOS-Swift',
  8. app_name: '',
  9. app_version: '7.1.3',
  10. app_build: '1',
  11. app_id: '3145EA1A-0EAE-3F8C-969A-13A01394D3EA',
  12. type: 'app',
  13. };
  14. export const appMetaMockData = {
  15. app_name: {
  16. '': {
  17. chunks: [
  18. {
  19. remark: 'x',
  20. rule_id: 'project:0',
  21. text: '',
  22. type: 'redaction',
  23. },
  24. ],
  25. len: 9,
  26. rem: [['project:0', 'x', 0, 0]],
  27. },
  28. },
  29. };
  30. const event = {
  31. ...TestStubs.Event(),
  32. _meta: {
  33. contexts: {
  34. app: appMetaMockData,
  35. },
  36. },
  37. };
  38. describe('app event context', function () {
  39. it('display redacted data', async function () {
  40. render(<AppEventContext event={event} data={appMockData} />);
  41. expect(screen.getByText('Build Name')).toBeInTheDocument(); // subject
  42. expect(screen.getByText(/redacted/)).toBeInTheDocument(); // value
  43. userEvent.hover(screen.getByText(/redacted/));
  44. expect(
  45. await screen.findByText('Removed because of PII rule "project:0"')
  46. ).toBeInTheDocument(); // tooltip description
  47. });
  48. });