eventSdk.spec.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 {EventSdk} from 'sentry/components/events/eventSdk';
  5. import {OrganizationContext} from 'sentry/views/organizationContext';
  6. import {RouteContext} from 'sentry/views/routeContext';
  7. describe('event sdk', function () {
  8. it('display redacted tags', 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. sdk: {
  19. name: 'sentry.cocoa',
  20. version: '',
  21. },
  22. _meta: {
  23. sdk: {
  24. version: {'': {rem: [['organization:0', 'x']]}},
  25. },
  26. },
  27. };
  28. render(
  29. <OrganizationContext.Provider value={organization}>
  30. <RouteContext.Provider
  31. value={{
  32. router,
  33. location: router.location,
  34. params: {},
  35. routes: [],
  36. }}
  37. >
  38. <EventSdk sdk={event.sdk} meta={event._meta.sdk} />
  39. </RouteContext.Provider>
  40. </OrganizationContext.Provider>
  41. );
  42. userEvent.hover(screen.getByText(/redacted/));
  43. expect(
  44. await screen.findByText(
  45. textWithMarkupMatcher(
  46. 'Removed because of the PII rule [Replace] [Password fields] with [Scrubbed] from [password] in the settings of the organization org-slug'
  47. )
  48. )
  49. ).toBeInTheDocument(); // tooltip description
  50. });
  51. });