|
@@ -48,4 +48,150 @@ describe('PlansLocator', function () {
|
|
|
expect(plan).to.be.a('null')
|
|
expect(plan).to.be.a('null')
|
|
|
})
|
|
})
|
|
|
})
|
|
})
|
|
|
|
|
+
|
|
|
|
|
+ describe('mapRecurlyPlanCodeToStripeLookupKey', function () {
|
|
|
|
|
+ it('should map "collaborator" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'collaborator'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('standard_monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should map "collaborator_free_trial_7_days" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'collaborator_free_trial_7_days'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('standard_monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should map "collaborator-annual" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'collaborator-annual'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('standard_annual')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should map "professional" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'professional'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('professional_monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should map "professional_free_trial_7_days" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'professional_free_trial_7_days'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('professional_monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should map "professional-annual" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'professional-annual'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('professional_annual')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should map "student" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'student'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('student_monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('shoult map "student_free_trial_7_days" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'student_free_trial_7_days'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('student_monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should map "student-annual" plan code to stripe lookup keys', function () {
|
|
|
|
|
+ const planCode = 'student-annual'
|
|
|
|
|
+ const lookupKey =
|
|
|
|
|
+ this.PlansLocator.mapRecurlyPlanCodeToStripeLookupKey(planCode)
|
|
|
|
|
+ expect(lookupKey).to.equal('student_annual')
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ describe('getPlanTypeAndPeriodFromRecurlyPlanCode', function () {
|
|
|
|
|
+ it('should return the plan type and period for "collaborator"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode(
|
|
|
|
|
+ 'collaborator'
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(planType).to.equal('standard')
|
|
|
|
|
+ expect(period).to.equal('monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should return the plan type and period for "collaborator_free_trial_7_days"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode(
|
|
|
|
|
+ 'collaborator_free_trial_7_days'
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(planType).to.equal('standard')
|
|
|
|
|
+ expect(period).to.equal('monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should return the plan type and period for "collaborator-annual"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode(
|
|
|
|
|
+ 'collaborator-annual'
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(planType).to.equal('standard')
|
|
|
|
|
+ expect(period).to.equal('annual')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should return the plan type and period for "professional"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode(
|
|
|
|
|
+ 'professional'
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(planType).to.equal('professional')
|
|
|
|
|
+ expect(period).to.equal('monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should return the plan type and period for "professional_free_trial_7_days"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode(
|
|
|
|
|
+ 'professional_free_trial_7_days'
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(planType).to.equal('professional')
|
|
|
|
|
+ expect(period).to.equal('monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should return the plan type and period for "professional-annual"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode(
|
|
|
|
|
+ 'professional-annual'
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(planType).to.equal('professional')
|
|
|
|
|
+ expect(period).to.equal('annual')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should return the plan type and period for "student"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode('student')
|
|
|
|
|
+ expect(planType).to.equal('student')
|
|
|
|
|
+ expect(period).to.equal('monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should return the plan type and period for "student_free_trial_7_days"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode(
|
|
|
|
|
+ 'student_free_trial_7_days'
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(planType).to.equal('student')
|
|
|
|
|
+ expect(period).to.equal('monthly')
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ it('should return the plan type and period for "student-annual"', function () {
|
|
|
|
|
+ const { planType, period } =
|
|
|
|
|
+ this.PlansLocator.getPlanTypeAndPeriodFromRecurlyPlanCode(
|
|
|
|
|
+ 'student-annual'
|
|
|
|
|
+ )
|
|
|
|
|
+ expect(planType).to.equal('student')
|
|
|
|
|
+ expect(period).to.equal('annual')
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
})
|
|
})
|