overleaf/services/web/test/frontend/features/subscription/components/dashboard/subscription-dashboard.test.tsx
Alexandre Bourdin 8b00a496e7 Merge pull request #11881 from overleaf/ab-custom-subscription-react-dash
[web] Add a contact support message for custom subsbcriptions on React dash

GitOrigin-RevId: e2a2bb27b4f1e70cbbe62f4c837fe63d81a820c2
2023-02-23 09:05:05 +00:00

60 lines
1.6 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { expect } from 'chai'
import { screen } from '@testing-library/react'
import SubscriptionDashboard from '../../../../../../frontend/js/features/subscription/components/dashboard/subscription-dashboard'
import {
cleanUpContext,
renderWithSubscriptionDashContext,
} from '../../helpers/render-with-subscription-dash-context'
describe('<SubscriptionDashboard />', function () {
afterEach(function () {
cleanUpContext()
})
describe('Free Plan', function () {
beforeEach(function () {
renderWithSubscriptionDashContext(<SubscriptionDashboard />)
})
it('does not render the "Get the most out of your" subscription text', function () {
const text = screen.queryByText('Get the most out of your', {
exact: false,
})
expect(text).to.be.null
})
it('does not render the contact support message', function () {
const text = screen.queryByText(
`Youre on an Overleaf Paid plan. Contact`,
{
exact: false,
}
)
expect(text).to.be.null
})
})
describe('Custom subscription', function () {
it('renders the contact support message', function () {
renderWithSubscriptionDashContext(<SubscriptionDashboard />, {
metaTags: [
{
name: 'ol-currentInstitutionsWithLicence',
value: [],
},
{
name: 'ol-hasSubscription',
value: true,
},
],
})
screen.getByText(`Youre on an Overleaf Paid plan.`, {
exact: false,
})
screen.getByText(`Contact support`, {
exact: false,
})
})
})
})