csp.spec.tsx 917 B

12345678910111213141516171819202122232425262728293031
  1. import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
  2. import {Csp} from 'sentry/components/events/interfaces/csp';
  3. import {EntryType} from 'sentry/types/event';
  4. describe('Csp report entry', function () {
  5. it('display redacted data', async function () {
  6. const event = {
  7. ...TestStubs.Event(),
  8. entries: [{type: EntryType.CSP, data: {effective_directive: ''}}],
  9. _meta: {
  10. entries: {
  11. 0: {
  12. data: {
  13. effective_directive: {'': {rem: [['project:1', 'x']]}},
  14. },
  15. },
  16. },
  17. },
  18. };
  19. render(<Csp data={event.entries[0].data} event={event} />);
  20. expect(screen.getByText(/redacted/)).toBeInTheDocument();
  21. userEvent.hover(screen.getByText(/redacted/));
  22. expect(
  23. await screen.findByText('Removed because of PII rule "project:1"')
  24. ).toBeInTheDocument(); // tooltip description
  25. });
  26. });