insightsDateRangeQueryLimitFooter.spec.tsx 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import {OrganizationFixture} from 'sentry-fixture/organization';
  2. import {BillingConfigFixture} from 'getsentry-test/fixtures/billingConfig';
  3. import {SubscriptionFixture} from 'getsentry-test/fixtures/subscription';
  4. import {render, screen} from 'sentry-test/reactTestingLibrary';
  5. import {InsightsDateRangeQueryLimitFooter} from 'getsentry/components/features/insightsDateRangeQueryLimitFooter';
  6. import {PlanTier} from 'getsentry/types';
  7. describe('InsightsUpsellPage', function () {
  8. const organization = OrganizationFixture();
  9. const subscription = SubscriptionFixture({
  10. organization,
  11. plan: 'am3_team',
  12. isFree: true,
  13. planTier: PlanTier.AM3,
  14. });
  15. beforeEach(() => {
  16. MockApiClient.clearMockResponses();
  17. MockApiClient.addMockResponse({
  18. url: `/customers/${organization.slug}/billing-config/`,
  19. body: BillingConfigFixture(PlanTier.AM3),
  20. });
  21. MockApiClient.addMockResponse({
  22. url: `/subscriptions/org-slug/`,
  23. body: {},
  24. });
  25. subscription.planDetails.features = [];
  26. });
  27. it('renders if plan includes feature', async function () {
  28. subscription.planDetails.features = ['insights-query-date-range-limit'];
  29. render(
  30. <InsightsDateRangeQueryLimitFooter
  31. organization={organization}
  32. subscription={subscription}
  33. />
  34. );
  35. expect(
  36. await screen.findByText(
  37. 'To view more trends for your Performance data, upgrade to Business.'
  38. )
  39. ).toBeInTheDocument();
  40. });
  41. it('does not render if feature is not included', function () {
  42. render(
  43. <InsightsDateRangeQueryLimitFooter
  44. organization={organization}
  45. subscription={subscription}
  46. />
  47. );
  48. expect(
  49. screen.queryByText(
  50. 'To view more trends for your Performance data, upgrade to Business.'
  51. )
  52. ).not.toBeInTheDocument();
  53. });
  54. });