Remove "upgrade to annual" page (#18014)

GitOrigin-RevId: b9f92ad038adab7fc7eb5e2a7175461bfefee379
This commit is contained in:
Alf Eaton
2024-04-23 09:30:29 +01:00
committed by Copybot
parent eabece9e0f
commit 98cefaa5bd
7 changed files with 0 additions and 245 deletions
@@ -695,100 +695,4 @@ describe('SubscriptionController', function () {
})
})
})
describe('renderUpgradeToAnnualPlanPage', function () {
it('should redirect to the plans page if the user does not have a subscription', function (done) {
this.LimitationsManager.userHasV2Subscription.callsArgWith(1, null, false)
this.res.redirect = function (url) {
url.should.equal('/user/subscription/plans')
done()
}
this.SubscriptionController.renderUpgradeToAnnualPlanPage(
this.req,
this.res
)
})
it('should pass the plan code to the view - student', function (done) {
this.LimitationsManager.userHasV2Subscription.callsArgWith(
1,
null,
true,
{ planCode: 'Student free trial 14 days' }
)
this.res.render = function (view, opts) {
view.should.equal('subscriptions/upgradeToAnnual')
opts.planName.should.equal('student')
done()
}
this.SubscriptionController.renderUpgradeToAnnualPlanPage(
this.req,
this.res
)
})
it('should pass the plan code to the view - collaborator', function (done) {
this.LimitationsManager.userHasV2Subscription.callsArgWith(
1,
null,
true,
{ planCode: 'free trial for Collaborator free trial 14 days' }
)
this.res.render = function (view, opts) {
opts.planName.should.equal('collaborator')
done()
}
this.SubscriptionController.renderUpgradeToAnnualPlanPage(
this.req,
this.res
)
})
it('should pass annual as the plan name if the user is already on an annual plan', function (done) {
this.LimitationsManager.userHasV2Subscription.callsArgWith(
1,
null,
true,
{ planCode: 'student annual with free trial' }
)
this.res.render = function (view, opts) {
opts.planName.should.equal('annual')
done()
}
this.SubscriptionController.renderUpgradeToAnnualPlanPage(
this.req,
this.res
)
})
})
describe('processUpgradeToAnnualPlan', function () {
beforeEach(function () {})
it('should tell the subscription handler to update the subscription with the annual plan and apply a coupon code', function (done) {
this.req.body = { planName: 'student' }
this.res.sendStatus = () => {
this.SubscriptionHandler.updateSubscription
.calledWith(this.user, 'student-annual', 'STUDENTCODEHERE')
.should.equal(true)
done()
}
this.SubscriptionController.processUpgradeToAnnualPlan(this.req, this.res)
})
it('should get the collaborator coupon code', function (done) {
this.req.body = { planName: 'collaborator' }
this.res.sendStatus = url => {
this.SubscriptionHandler.updateSubscription
.calledWith(this.user, 'collaborator-annual', 'COLLABORATORCODEHERE')
.should.equal(true)
done()
}
this.SubscriptionController.processUpgradeToAnnualPlan(this.req, this.res)
})
})
})