index.spec.tsx 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  2. import {OperatingSystemEventContext} from 'sentry/components/events/contexts/operatingSystem';
  3. export const operatingSystemMockData = {
  4. name: 'Mac OS X 10.14.0',
  5. version: '',
  6. raw_description: '',
  7. build: '',
  8. kernel_version: '',
  9. };
  10. export const operatingSystemMetaMockData = {
  11. raw_description: {
  12. '': {
  13. chunks: [
  14. {
  15. remark: 'x',
  16. rule_id: 'project:0',
  17. text: '',
  18. type: 'redaction',
  19. },
  20. ],
  21. len: 9,
  22. rem: [['project:0', 'x', 0, 0]],
  23. },
  24. },
  25. };
  26. const event = {
  27. ...TestStubs.Event(),
  28. _meta: {
  29. contexts: {
  30. os: operatingSystemMetaMockData,
  31. },
  32. },
  33. };
  34. describe('operating system event context', function () {
  35. it('display redacted data', async function () {
  36. render(<OperatingSystemEventContext event={event} data={operatingSystemMockData} />);
  37. expect(screen.getByText('Raw Description')).toBeInTheDocument(); // subject
  38. userEvent.hover(screen.getByText(/redacted/));
  39. expect(
  40. await screen.findByText('Removed because of PII rule "project:0"')
  41. ).toBeInTheDocument(); // tooltip description
  42. });
  43. });