mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
42 lines
1.0 KiB
TypeScript
42 lines
1.0 KiB
TypeScript
import {render} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import {Banner} from './banner';
|
|
|
|
function mockIsSentryEmployee(isEmployee: boolean) {
|
|
jest
|
|
.spyOn(require('sentry/utils/useIsSentryEmployee'), 'useIsSentryEmployee')
|
|
.mockImplementation(() => isEmployee);
|
|
}
|
|
|
|
describe('PII Certification Check', () => {
|
|
afterEach(() => {
|
|
jest.resetAllMocks();
|
|
});
|
|
|
|
it('shows PII check for sentry employee users', () => {
|
|
mockIsSentryEmployee(true);
|
|
|
|
const {getByText} = render(
|
|
<Banner
|
|
onButtonClick={() => {}}
|
|
additionalContext=""
|
|
setAdditionalContext={() => {}}
|
|
/>
|
|
);
|
|
expect(getByText('Certify No PII')).toBeInTheDocument();
|
|
});
|
|
|
|
it('does not show PII check for non sentry employee users', () => {
|
|
mockIsSentryEmployee(false);
|
|
|
|
const {queryByText} = render(
|
|
<Banner
|
|
onButtonClick={() => {}}
|
|
additionalContext=""
|
|
setAdditionalContext={() => {}}
|
|
/>
|
|
);
|
|
expect(queryByText('Certify No PII')).not.toBeInTheDocument();
|
|
});
|
|
});
|