-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathindex.spec.tsx
60 lines (53 loc) · 1.65 KB
/
index.spec.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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
});
});