mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-01 21:31:36 +02:00
Merge pull request #23203 from overleaf/ii-flexible-group-licensing-no-billing-details
[web] FL handle subscriptions with missing billing info GitOrigin-RevId: 34209299c039992a80da5739e086beb5d0ede7b0
This commit is contained in:
@@ -99,6 +99,7 @@ describe('RecurlyClient', function () {
|
||||
let client
|
||||
this.client = client = {
|
||||
getAccount: sinon.stub(),
|
||||
getBillingInfo: sinon.stub(),
|
||||
listAccountSubscriptions: sinon.stub(),
|
||||
previewSubscriptionChange: sinon.stub(),
|
||||
}
|
||||
@@ -108,6 +109,9 @@ describe('RecurlyClient', function () {
|
||||
return client
|
||||
},
|
||||
}
|
||||
this.Errors = {
|
||||
MissingBillingInfoError: class MissingBillingInfoError extends Error {},
|
||||
}
|
||||
|
||||
return (this.RecurlyClient = SandboxedModule.require(MODULE_PATH, {
|
||||
globals: {
|
||||
@@ -124,6 +128,7 @@ describe('RecurlyClient', function () {
|
||||
debug: sinon.stub(),
|
||||
},
|
||||
'../User/UserGetter': this.UserGetter,
|
||||
'./Errors': this.Errors,
|
||||
},
|
||||
}))
|
||||
})
|
||||
@@ -463,4 +468,22 @@ describe('RecurlyClient', function () {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('getPaymentMethod', function () {
|
||||
it('should throw MissingBillingInfoError', async function () {
|
||||
this.client.getBillingInfo = sinon
|
||||
.stub()
|
||||
.throws(new recurly.errors.NotFoundError())
|
||||
await expect(
|
||||
this.RecurlyClient.promises.getPaymentMethod(this.user._id)
|
||||
).to.be.rejectedWith(this.Errors.MissingBillingInfoError)
|
||||
})
|
||||
|
||||
it('should rethrow errors different than MissingBillingInfoError', async function () {
|
||||
this.client.getBillingInfo = sinon.stub().throws(new Error())
|
||||
await expect(
|
||||
this.RecurlyClient.promises.getPaymentMethod(this.user._id)
|
||||
).to.be.rejectedWith(Error)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user