Merge pull request #2609 from overleaf/ta-cmg-recurly-email-update
Add UI to Update Recurly Email GitOrigin-RevId: 920a741fd9b4312f031bdd40e3d6bec48f1bd579
This commit is contained in:
@@ -257,6 +257,49 @@ describe('RecurlyWrapper', function() {
|
||||
})
|
||||
})
|
||||
|
||||
describe('updateAccountEmailAddress', function() {
|
||||
beforeEach(function(done) {
|
||||
this.recurlyAccountId = 'account-id-123'
|
||||
this.newEmail = 'example@overleaf.com'
|
||||
this.apiRequest = sinon
|
||||
.stub(this.RecurlyWrapper, 'apiRequest')
|
||||
.callsFake((options, callback) => {
|
||||
this.requestOptions = options
|
||||
callback(null, {}, fixtures['accounts/104'])
|
||||
})
|
||||
|
||||
this.RecurlyWrapper.updateAccountEmailAddress(
|
||||
this.recurlyAccountId,
|
||||
this.newEmail,
|
||||
(error, recurlyAccount) => {
|
||||
this.recurlyAccount = recurlyAccount
|
||||
done()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
afterEach(function() {
|
||||
return this.RecurlyWrapper.apiRequest.restore()
|
||||
})
|
||||
|
||||
it('sends correct XML', function() {
|
||||
this.apiRequest.called.should.equal(true)
|
||||
const { body } = this.apiRequest.lastCall.args[0]
|
||||
expect(body).to.equal(`\
|
||||
<account>
|
||||
<email>example@overleaf.com</email>
|
||||
</account>\
|
||||
`)
|
||||
this.requestOptions.url.should.equal(`accounts/${this.recurlyAccountId}`)
|
||||
this.requestOptions.method.should.equal('PUT')
|
||||
})
|
||||
|
||||
it('should return the updated account', function() {
|
||||
should.exist(this.recurlyAccount)
|
||||
this.recurlyAccount.account_code.should.equal('104')
|
||||
})
|
||||
})
|
||||
|
||||
describe('updateSubscription', function() {
|
||||
beforeEach(function(done) {
|
||||
this.recurlySubscriptionId = 'subscription-id-123'
|
||||
|
||||
Reference in New Issue
Block a user