generic.spec.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import {DataScrubbingRelayPiiConfigFixture} from 'sentry-fixture/dataScrubbingRelayPiiConfig';
  2. import {EventFixture} from 'sentry-fixture/event';
  3. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  4. import {textWithMarkupMatcher} from 'sentry-test/utils';
  5. import {Generic} from 'sentry/components/events/interfaces/generic';
  6. describe('Generic entry', function () {
  7. it('display redacted data', async function () {
  8. const event = EventFixture({
  9. _meta: {
  10. hpkp: {'': {rem: [['organization:1', 'x']]}},
  11. },
  12. });
  13. render(<Generic type="hpkp" data={null} meta={event._meta?.hpkp} />, {
  14. organization: {
  15. relayPiiConfig: JSON.stringify(DataScrubbingRelayPiiConfigFixture()),
  16. },
  17. });
  18. expect(screen.getByText(/redacted/)).toBeInTheDocument();
  19. await userEvent.hover(screen.getByText(/redacted/));
  20. expect(
  21. await screen.findByText(
  22. textWithMarkupMatcher(
  23. "Removed because of the data scrubbing rule [Mask] [Credit card numbers] from [$message] in your organization's settings"
  24. )
  25. )
  26. ).toBeInTheDocument(); // tooltip description
  27. });
  28. });