mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
61 lines
1.6 KiB
TypeScript
61 lines
1.6 KiB
TypeScript
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(); // subject
|
|
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(); // tooltip description
|
|
});
|
|
});
|