123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import {DataScrubbingRelayPiiConfigFixture} from 'sentry-fixture/dataScrubbingRelayPiiConfig';
- import {EventFixture} from 'sentry-fixture/event';
- import {render, screen, userEvent} from 'sentry-test/reactTestingLibrary';
- import {textWithMarkupMatcher} from 'sentry-test/utils';
- import {OperatingSystemEventContext} from 'sentry/components/events/contexts/operatingSystem';
- export const operatingSystemMockData = {
- name: 'Mac OS X 10.14.0',
- version: '',
- raw_description: '',
- build: '',
- kernel_version: '',
- };
- export const operatingSystemMetaMockData = {
- raw_description: {
- '': {
- chunks: [
- {
- remark: 'x',
- rule_id: 'project:0',
- text: '',
- type: 'redaction',
- },
- ],
- len: 9,
- rem: [['organization:0', 'x', 0, 0]],
- },
- },
- };
- const event = EventFixture({
- _meta: {
- contexts: {
- os: operatingSystemMetaMockData,
- },
- },
- });
- describe('operating system event context', function () {
- it('display redacted data', async function () {
- render(<OperatingSystemEventContext event={event} data={operatingSystemMockData} />, {
- organization: {
- relayPiiConfig: JSON.stringify(DataScrubbingRelayPiiConfigFixture()),
- },
- });
- expect(screen.getByText('Raw Description')).toBeInTheDocument();
- await userEvent.hover(screen.getByText(/redacted/));
- expect(
- await screen.findByText(
- textWithMarkupMatcher(
- "Removed because of the data scrubbing rule [Replace] [Password fields] with [Scrubbed] from [password] in your organization's settings"
- )
- )
- ).toBeInTheDocument();
- });
- });
|