mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-12 00:35:03 +00:00
Merge pull request #2572 from overleaf/ta-personal-plan-test
Personal Plan Filter Test GitOrigin-RevId: e0e75bdd43b27cda787d039f9cfaad64e96afa67
This commit is contained in:
parent
7844037404
commit
f2636e0555
4 changed files with 14 additions and 5 deletions
|
@ -35,7 +35,7 @@ const HttpErrors = require('@overleaf/o-error/http')
|
|||
|
||||
module.exports = SubscriptionController = {
|
||||
plansPage(req, res, next) {
|
||||
const plans = SubscriptionViewModelBuilder.buildViewModel()
|
||||
const plans = SubscriptionViewModelBuilder.buildPlansList()
|
||||
let viewName = 'subscriptions/plans'
|
||||
if (req.query.v != null) {
|
||||
viewName = `${viewName}_${req.query.v}`
|
||||
|
@ -167,7 +167,7 @@ module.exports = SubscriptionController = {
|
|||
return next(error)
|
||||
}
|
||||
const fromPlansPage = req.query.hasSubscription
|
||||
const plans = SubscriptionViewModelBuilder.buildViewModel()
|
||||
const plans = SubscriptionViewModelBuilder.buildPlansList()
|
||||
const data = {
|
||||
title: 'your_subscription',
|
||||
plans,
|
||||
|
|
|
@ -250,7 +250,7 @@ module.exports = {
|
|||
)
|
||||
},
|
||||
|
||||
buildViewModel() {
|
||||
buildPlansList() {
|
||||
const { plans } = Settings
|
||||
|
||||
const allPlans = {}
|
||||
|
|
|
@ -27,6 +27,15 @@ describe('Subscriptions', function() {
|
|||
return this.user.ensureUserExists(done)
|
||||
})
|
||||
|
||||
it('should not list personal plan', function() {
|
||||
const plans = SubscriptionViewModelBuilder.buildPlansList()
|
||||
expect(plans.individualMonthlyPlans).to.be.a('Array')
|
||||
const personalMonthlyPlan = plans.individualMonthlyPlans.find(
|
||||
plan => plan.planCode === 'personal'
|
||||
)
|
||||
expect(personalMonthlyPlan).to.be.undefined
|
||||
})
|
||||
|
||||
describe('when the user has no subscription', function() {
|
||||
beforeEach(function(done) {
|
||||
return SubscriptionViewModelBuilder.buildUsersSubscriptionViewModel(
|
||||
|
|
|
@ -76,7 +76,7 @@ describe('SubscriptionController', function() {
|
|||
|
||||
this.SubscriptionViewModelBuilder = {
|
||||
buildUsersSubscriptionViewModel: sinon.stub().callsArgWith(1, null, {}),
|
||||
buildViewModel: sinon.stub()
|
||||
buildPlansList: sinon.stub()
|
||||
}
|
||||
this.settings = {
|
||||
coupon_codes: {
|
||||
|
@ -339,7 +339,7 @@ describe('SubscriptionController', function() {
|
|||
})
|
||||
}
|
||||
)
|
||||
this.SubscriptionViewModelBuilder.buildViewModel.returns(
|
||||
this.SubscriptionViewModelBuilder.buildPlansList.returns(
|
||||
(this.plans = { plans: 'mock' })
|
||||
)
|
||||
this.LimitationsManager.userHasV1OrV2Subscription.callsArgWith(
|
||||
|
|
Loading…
Add table
Reference in a new issue