index.spec.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {render, screen} from 'sentry-test/reactTestingLibrary';
  3. import AlertsContainer from 'sentry/views/alerts';
  4. describe('AlertsContainer', function () {
  5. function SubView({hasMetricAlerts}: {hasMetricAlerts?: boolean}) {
  6. return <div>{hasMetricAlerts ? 'access' : 'no access'}</div>;
  7. }
  8. describe('no access without feature flag', function () {
  9. it('display no access message', function () {
  10. const organization = OrganizationFixture();
  11. render(
  12. <AlertsContainer>
  13. <SubView />
  14. </AlertsContainer>,
  15. {
  16. organization,
  17. }
  18. );
  19. expect(screen.getByText('no access')).toBeInTheDocument();
  20. });
  21. it('allows access', function () {
  22. const organization = OrganizationFixture({
  23. features: ['incidents'],
  24. });
  25. render(
  26. <AlertsContainer>
  27. <SubView />
  28. </AlertsContainer>,
  29. {
  30. organization,
  31. }
  32. );
  33. expect(screen.getByText('access')).toBeInTheDocument();
  34. });
  35. });
  36. });