subscription-dashboard.test.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. import { expect } from 'chai'
  2. import { screen } from '@testing-library/react'
  3. import SubscriptionDashboard from '../../../../../../frontend/js/features/subscription/components/dashboard/subscription-dashboard'
  4. import {
  5. cleanUpContext,
  6. renderWithSubscriptionDashContext,
  7. } from '../../helpers/render-with-subscription-dash-context'
  8. describe('<SubscriptionDashboard />', function () {
  9. afterEach(function () {
  10. cleanUpContext()
  11. })
  12. describe('Free Plan', function () {
  13. beforeEach(function () {
  14. renderWithSubscriptionDashContext(<SubscriptionDashboard />)
  15. })
  16. it('does not render the "Get the most out of your" subscription text', function () {
  17. const text = screen.queryByText('Get the most out of your', {
  18. exact: false,
  19. })
  20. expect(text).to.be.null
  21. })
  22. it('does not render the contact support message', function () {
  23. const text = screen.queryByText(
  24. `You’re on an Overleaf Paid plan. Contact`,
  25. {
  26. exact: false,
  27. }
  28. )
  29. expect(text).to.be.null
  30. })
  31. })
  32. describe('Custom subscription', function () {
  33. it('renders the contact support message', function () {
  34. renderWithSubscriptionDashContext(<SubscriptionDashboard />, {
  35. metaTags: [
  36. {
  37. name: 'ol-currentInstitutionsWithLicence',
  38. value: [],
  39. },
  40. {
  41. name: 'ol-hasSubscription',
  42. value: true,
  43. },
  44. ],
  45. })
  46. screen.getByText(`You’re on an Overleaf Paid plan.`, {
  47. exact: false,
  48. })
  49. screen.getByText(`Contact support`, {
  50. exact: false,
  51. })
  52. })
  53. })
  54. })