mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
45 lines
1.3 KiB
TypeScript
45 lines
1.3 KiB
TypeScript
import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import useDismissAlertImport from 'sentry/utils/useDismissAlert';
|
|
|
|
import ReplayInlineOnboardingPanel from './replayInlineOnboardingPanel';
|
|
|
|
jest.mock('sentry/utils/localStorage');
|
|
jest.mock('sentry/utils/useDismissAlert');
|
|
const useDismissAlert = jest.mocked(useDismissAlertImport);
|
|
|
|
describe('replayInlineOnboardingPanel', () => {
|
|
beforeEach(() => {
|
|
jest.clearAllMocks();
|
|
useDismissAlert.mockClear();
|
|
});
|
|
|
|
it('should render if not dismissed', async () => {
|
|
const dismiss = jest.fn();
|
|
useDismissAlert.mockImplementation(() => {
|
|
return {
|
|
dismiss,
|
|
isDismissed: false,
|
|
};
|
|
});
|
|
render(<ReplayInlineOnboardingPanel platform="react" projectId="123" />);
|
|
expect(
|
|
await screen.findByText('Watch the errors and latency issues your users face')
|
|
).toBeInTheDocument();
|
|
});
|
|
|
|
it('should not render if dismissed', async () => {
|
|
const dismiss = jest.fn();
|
|
useDismissAlert.mockImplementation(() => {
|
|
return {
|
|
dismiss,
|
|
isDismissed: true,
|
|
};
|
|
});
|
|
render(<ReplayInlineOnboardingPanel platform="react" projectId="123" />);
|
|
expect(
|
|
await screen.queryByText('Watch the errors and latency issues your users face')
|
|
).not.toBeInTheDocument();
|
|
});
|
|
});
|