mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-05 07:09:02 +02:00
Merge pull request #6837 from overleaf/jpa-drop-v1-subscription-lookup
[web] drop support for v1 subscriptions GitOrigin-RevId: ddffa60398d5319959f9e5455520a61fa58fab37
This commit is contained in:
@@ -7,11 +7,12 @@ const MODULE_PATH = '../../../../app/src/Features/Subscription/FeaturesUpdater'
|
||||
|
||||
describe('FeaturesUpdater', function () {
|
||||
beforeEach(function () {
|
||||
this.v1UserId = 12345
|
||||
this.user = {
|
||||
_id: new ObjectId(),
|
||||
features: {},
|
||||
overleaf: { id: this.v1UserId },
|
||||
}
|
||||
this.v1UserId = 12345
|
||||
this.subscriptions = {
|
||||
individual: { planCode: 'individual-plan' },
|
||||
group1: { planCode: 'group-plan-1' },
|
||||
@@ -46,7 +47,6 @@ describe('FeaturesUpdater', function () {
|
||||
{ planCode: 'individual-plan', features: { individual: 'features' } },
|
||||
{ planCode: 'group-plan-1', features: { group1: 'features' } },
|
||||
{ planCode: 'group-plan-2', features: { group2: 'features' } },
|
||||
{ planCode: 'v1-plan', features: { v1: 'features' } },
|
||||
{ planCode: 'no-dropbox', features: { dropbox: false } },
|
||||
],
|
||||
features: {
|
||||
@@ -56,7 +56,6 @@ describe('FeaturesUpdater', function () {
|
||||
group1: 'features',
|
||||
group2: 'features',
|
||||
institutions: 'features',
|
||||
v1: 'features',
|
||||
grandfathered: 'features',
|
||||
bonus: 'features',
|
||||
},
|
||||
@@ -70,13 +69,7 @@ describe('FeaturesUpdater', function () {
|
||||
}
|
||||
this.V1SubscriptionManager = {
|
||||
getGrandfatheredFeaturesForV1User: sinon.stub(),
|
||||
promises: {
|
||||
getPlanCodeFromV1: sinon.stub(),
|
||||
},
|
||||
}
|
||||
this.V1SubscriptionManager.promises.getPlanCodeFromV1
|
||||
.withArgs(this.user._id)
|
||||
.resolves({ planCode: 'v1-plan', v1Id: this.v1UserId })
|
||||
this.V1SubscriptionManager.getGrandfatheredFeaturesForV1User
|
||||
.withArgs(this.v1UserId)
|
||||
.returns({ grandfathered: 'features' })
|
||||
|
||||
@@ -54,62 +54,6 @@ describe('V1SubscriptionManager', function () {
|
||||
})
|
||||
})
|
||||
|
||||
describe('getPlanCodeFromV1', function () {
|
||||
beforeEach(function () {
|
||||
this.responseBody = {
|
||||
id: 32,
|
||||
plan_name: 'pro',
|
||||
}
|
||||
this.V1SubscriptionManager._v1Request = sinon
|
||||
.stub()
|
||||
.yields(null, this.responseBody)
|
||||
return (this.call = cb => {
|
||||
return this.V1SubscriptionManager.getPlanCodeFromV1(this.userId, cb)
|
||||
})
|
||||
})
|
||||
|
||||
describe('when all goes well', function () {
|
||||
it('should call _v1Request', function (done) {
|
||||
return this.call((err, planCode) => {
|
||||
expect(this.V1SubscriptionManager._v1Request.callCount).to.equal(1)
|
||||
expect(
|
||||
this.V1SubscriptionManager._v1Request.calledWith(this.userId)
|
||||
).to.equal(true)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should return the v1 user id', function (done) {
|
||||
return this.call(function (err, planCode, v1Id) {
|
||||
expect(v1Id).to.equal(this.v1UserId)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
it('should produce a plan-code without error', function (done) {
|
||||
return this.call((err, planCode) => {
|
||||
expect(err).to.not.exist
|
||||
expect(planCode).to.equal('v1_pro')
|
||||
return done()
|
||||
})
|
||||
})
|
||||
|
||||
describe('when the plan_name from v1 is null', function () {
|
||||
beforeEach(function () {
|
||||
return (this.responseBody.plan_name = null)
|
||||
})
|
||||
|
||||
it('should produce a null plan-code without error', function (done) {
|
||||
return this.call((err, planCode) => {
|
||||
expect(err).to.not.exist
|
||||
expect(planCode).to.equal(null)
|
||||
return done()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('getGrandfatheredFeaturesForV1User', function () {
|
||||
describe('when the user ID is greater than the cutoff', function () {
|
||||
it('should return an empty feature set', function (done) {
|
||||
|
||||
Reference in New Issue
Block a user