generic.spec.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import {initializeOrg} from 'sentry-test/initializeOrg';
  2. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  3. import {textWithMarkupMatcher} from 'sentry-test/utils';
  4. import {Generic} from 'sentry/components/events/interfaces/generic';
  5. import {OrganizationContext} from 'sentry/views/organizationContext';
  6. import {RouteContext} from 'sentry/views/routeContext';
  7. describe('Generic entry', function () {
  8. it('display redacted data', async function () {
  9. const {organization, router} = initializeOrg({
  10. ...initializeOrg(),
  11. organization: {
  12. ...initializeOrg().organization,
  13. relayPiiConfig: JSON.stringify(TestStubs.DataScrubbingRelayPiiConfig()),
  14. },
  15. });
  16. const event = {
  17. ...TestStubs.Event(),
  18. _meta: {
  19. hpkp: {'': {rem: [['organization:1', 'x']]}},
  20. },
  21. };
  22. render(
  23. <OrganizationContext.Provider value={organization}>
  24. <RouteContext.Provider
  25. value={{
  26. router,
  27. location: router.location,
  28. params: {},
  29. routes: [],
  30. }}
  31. >
  32. <Generic type="hpkp" data={null} meta={event._meta.hpkp} />
  33. </RouteContext.Provider>
  34. </OrganizationContext.Provider>
  35. );
  36. expect(screen.getByText(/redacted/)).toBeInTheDocument();
  37. userEvent.hover(screen.getByText(/redacted/));
  38. expect(
  39. await screen.findByText(
  40. textWithMarkupMatcher(
  41. 'Removed because of the PII rule [Mask] [Credit card numbers] from [$message] in the settings of the organization org-slug'
  42. )
  43. )
  44. ).toBeInTheDocument(); // tooltip description
  45. });
  46. });