|
@@ -25,7 +25,7 @@ describe('<PersonalSubscription />', function () {
|
|
|
it('returns empty container', function () {
|
|
it('returns empty container', function () {
|
|
|
const { container } = render(
|
|
const { container } = render(
|
|
|
<SubscriptionDashboardProvider>
|
|
<SubscriptionDashboardProvider>
|
|
|
- <PersonalSubscription subscription={undefined} />
|
|
|
|
|
|
|
+ <PersonalSubscription />
|
|
|
</SubscriptionDashboardProvider>
|
|
</SubscriptionDashboardProvider>
|
|
|
)
|
|
)
|
|
|
expect(container.firstChild).to.be.null
|
|
expect(container.firstChild).to.be.null
|
|
@@ -34,9 +34,13 @@ describe('<PersonalSubscription />', function () {
|
|
|
|
|
|
|
|
describe('subscription states ', function () {
|
|
describe('subscription states ', function () {
|
|
|
it('renders the active dash', function () {
|
|
it('renders the active dash', function () {
|
|
|
|
|
+ window.metaAttributesCache.set(
|
|
|
|
|
+ 'ol-subscription',
|
|
|
|
|
+ annualActiveSubscription
|
|
|
|
|
+ )
|
|
|
render(
|
|
render(
|
|
|
<SubscriptionDashboardProvider>
|
|
<SubscriptionDashboardProvider>
|
|
|
- <PersonalSubscription subscription={annualActiveSubscription} />
|
|
|
|
|
|
|
+ <PersonalSubscription />
|
|
|
</SubscriptionDashboardProvider>
|
|
</SubscriptionDashboardProvider>
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -44,9 +48,10 @@ describe('<PersonalSubscription />', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('renders the canceled dash', function () {
|
|
it('renders the canceled dash', function () {
|
|
|
|
|
+ window.metaAttributesCache.set('ol-subscription', canceledSubscription)
|
|
|
render(
|
|
render(
|
|
|
<SubscriptionDashboardProvider>
|
|
<SubscriptionDashboardProvider>
|
|
|
- <PersonalSubscription subscription={canceledSubscription} />
|
|
|
|
|
|
|
+ <PersonalSubscription />
|
|
|
</SubscriptionDashboardProvider>
|
|
</SubscriptionDashboardProvider>
|
|
|
)
|
|
)
|
|
|
screen.getByText(
|
|
screen.getByText(
|
|
@@ -69,9 +74,13 @@ describe('<PersonalSubscription />', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('renders the expired dash', function () {
|
|
it('renders the expired dash', function () {
|
|
|
|
|
+ window.metaAttributesCache.set(
|
|
|
|
|
+ 'ol-subscription',
|
|
|
|
|
+ pastDueExpiredSubscription
|
|
|
|
|
+ )
|
|
|
render(
|
|
render(
|
|
|
<SubscriptionDashboardProvider>
|
|
<SubscriptionDashboardProvider>
|
|
|
- <PersonalSubscription subscription={pastDueExpiredSubscription} />
|
|
|
|
|
|
|
+ <PersonalSubscription />
|
|
|
</SubscriptionDashboardProvider>
|
|
</SubscriptionDashboardProvider>
|
|
|
)
|
|
)
|
|
|
screen.getByText('Your subscription has expired.')
|
|
screen.getByText('Your subscription has expired.')
|
|
@@ -83,9 +92,10 @@ describe('<PersonalSubscription />', function () {
|
|
|
JSON.parse(JSON.stringify(annualActiveSubscription))
|
|
JSON.parse(JSON.stringify(annualActiveSubscription))
|
|
|
)
|
|
)
|
|
|
withStateDeleted.recurly.state = undefined
|
|
withStateDeleted.recurly.state = undefined
|
|
|
|
|
+ window.metaAttributesCache.set('ol-subscription', withStateDeleted)
|
|
|
render(
|
|
render(
|
|
|
<SubscriptionDashboardProvider>
|
|
<SubscriptionDashboardProvider>
|
|
|
- <PersonalSubscription subscription={withStateDeleted} />
|
|
|
|
|
|
|
+ <PersonalSubscription />
|
|
|
</SubscriptionDashboardProvider>
|
|
</SubscriptionDashboardProvider>
|
|
|
)
|
|
)
|
|
|
screen.getByText(
|
|
screen.getByText(
|
|
@@ -96,9 +106,13 @@ describe('<PersonalSubscription />', function () {
|
|
|
|
|
|
|
|
describe('past due subscription', function () {
|
|
describe('past due subscription', function () {
|
|
|
it('renders error alert', function () {
|
|
it('renders error alert', function () {
|
|
|
|
|
+ window.metaAttributesCache.set(
|
|
|
|
|
+ 'ol-subscription',
|
|
|
|
|
+ pastDueExpiredSubscription
|
|
|
|
|
+ )
|
|
|
render(
|
|
render(
|
|
|
<SubscriptionDashboardProvider>
|
|
<SubscriptionDashboardProvider>
|
|
|
- <PersonalSubscription subscription={pastDueExpiredSubscription} />
|
|
|
|
|
|
|
+ <PersonalSubscription />
|
|
|
</SubscriptionDashboardProvider>
|
|
</SubscriptionDashboardProvider>
|
|
|
)
|
|
)
|
|
|
screen.getByRole('alert')
|
|
screen.getByRole('alert')
|
|
@@ -120,9 +134,13 @@ describe('<PersonalSubscription />', function () {
|
|
|
it('shows an alert and hides "Change plan" option when Recurly did not load', function () {
|
|
it('shows an alert and hides "Change plan" option when Recurly did not load', function () {
|
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
|
delete window.recurly
|
|
delete window.recurly
|
|
|
|
|
+ window.metaAttributesCache.set(
|
|
|
|
|
+ 'ol-subscription',
|
|
|
|
|
+ annualActiveSubscription
|
|
|
|
|
+ )
|
|
|
render(
|
|
render(
|
|
|
<SubscriptionDashboardProvider>
|
|
<SubscriptionDashboardProvider>
|
|
|
- <PersonalSubscription subscription={annualActiveSubscription} />
|
|
|
|
|
|
|
+ <PersonalSubscription />
|
|
|
</SubscriptionDashboardProvider>
|
|
</SubscriptionDashboardProvider>
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -133,9 +151,13 @@ describe('<PersonalSubscription />', function () {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('should not show an alert and should show "Change plan" option when Recurly did load', function () {
|
|
it('should not show an alert and should show "Change plan" option when Recurly did load', function () {
|
|
|
|
|
+ window.metaAttributesCache.set(
|
|
|
|
|
+ 'ol-subscription',
|
|
|
|
|
+ annualActiveSubscription
|
|
|
|
|
+ )
|
|
|
render(
|
|
render(
|
|
|
<SubscriptionDashboardProvider>
|
|
<SubscriptionDashboardProvider>
|
|
|
- <PersonalSubscription subscription={annualActiveSubscription} />
|
|
|
|
|
|
|
+ <PersonalSubscription />
|
|
|
</SubscriptionDashboardProvider>
|
|
</SubscriptionDashboardProvider>
|
|
|
)
|
|
)
|
|
|
|
|
|