mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-10-30 14:49:14 +00:00
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import {OrganizationFixture} from 'sentry-fixture/organization';
|
|
import {RouterContextFixture} from 'sentry-fixture/routerContextFixture';
|
|
|
|
import {render, screen} from 'sentry-test/reactTestingLibrary';
|
|
|
|
import AlertsContainer from 'sentry/views/alerts';
|
|
|
|
describe('AlertsContainer', function () {
|
|
function SubView({hasMetricAlerts}: {hasMetricAlerts?: boolean}) {
|
|
return <div>{hasMetricAlerts ? 'access' : 'no access'}</div>;
|
|
}
|
|
|
|
describe('no access without feature flag', function () {
|
|
it('display no access message', function () {
|
|
const organization = OrganizationFixture();
|
|
|
|
render(
|
|
<AlertsContainer>
|
|
<SubView />
|
|
</AlertsContainer>,
|
|
{
|
|
context: RouterContextFixture([{organization}]),
|
|
organization,
|
|
}
|
|
);
|
|
expect(screen.getByText('no access')).toBeInTheDocument();
|
|
});
|
|
|
|
it('allows access', function () {
|
|
const organization = OrganizationFixture({
|
|
features: ['incidents'],
|
|
});
|
|
|
|
render(
|
|
<AlertsContainer>
|
|
<SubView />
|
|
</AlertsContainer>,
|
|
{
|
|
context: RouterContextFixture([{organization}]),
|
|
organization,
|
|
}
|
|
);
|
|
expect(screen.getByText('access')).toBeInTheDocument();
|
|
});
|
|
});
|
|
});
|