1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- import {initializeOrg} from 'sentry-test/initializeOrg';
- import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
- import {textWithMarkupMatcher} from 'sentry-test/utils';
- import {Message} from 'sentry/components/events/interfaces/message';
- import {OrganizationContext} from 'sentry/views/organizationContext';
- import {RouteContext} from 'sentry/views/routeContext';
- describe('Message entry', function () {
- it('display redacted data', async function () {
- const {organization, router} = initializeOrg({
- ...initializeOrg(),
- organization: {
- ...initializeOrg().organization,
- relayPiiConfig: JSON.stringify(TestStubs.DataScrubbingRelayPiiConfig()),
- },
- });
- const event = {
- ...TestStubs.Event(),
- entries: [
- {
- type: 'message',
- data: {
- formatted: null,
- },
- },
- ],
- _meta: {
- entries: {
- 0: {
- data: {
- formatted: {'': {rem: [['organization:0', 'x']]}},
- },
- },
- },
- },
- };
- render(
- <OrganizationContext.Provider value={organization}>
- <RouteContext.Provider
- value={{
- router,
- location: router.location,
- params: {},
- routes: [],
- }}
- >
- <Message data={{formatted: null}} event={event} />
- </RouteContext.Provider>
- </OrganizationContext.Provider>
- );
- expect(screen.getByText(/redacted/)).toBeInTheDocument();
- userEvent.hover(screen.getByText(/redacted/));
- expect(
- await screen.findByText(
- textWithMarkupMatcher(
- 'Removed because of the PII rule [Replace] [Password fields] with [Scrubbed] from [password] in the settings of the organization org-slug'
- )
- )
- ).toBeInTheDocument(); // tooltip description
- expect(
- screen.getByRole('link', {
- name: '[Replace] [Password fields] with [Scrubbed] from [password]',
- })
- ).toHaveAttribute(
- 'href',
- '/settings/org-slug/security-and-privacy/advanced-data-scrubbing/0/'
- );
- expect(screen.getByRole('link', {name: 'org-slug'})).toHaveAttribute(
- 'href',
- '/settings/org-slug/'
- );
- });
- });
|