Merge pull request #2610 from overleaf/ta-recurly-email-update-auto

Update Recurly Email on Default Email Change

GitOrigin-RevId: e2821d7bdc4bc6befff2152d92c76952c38694f9
This commit is contained in:
Eric Mc Sween
2020-02-28 04:18:09 +00:00
committed by Copybot
parent 403c9ae66b
commit 174af14d46
2 changed files with 11 additions and 1 deletions
@@ -32,6 +32,7 @@ describe('UserUpdater', function() {
this.removeAffiliation = sinon.stub().callsArgWith(2, null)
this.refreshFeatures = sinon.stub().yields()
this.NewsletterManager = { changeEmail: sinon.stub() }
this.RecurlyWrapper = { updateAccountEmailAddress: sinon.stub() }
this.UserUpdater = SandboxedModule.require(modulePath, {
globals: {
console: console
@@ -55,7 +56,8 @@ describe('UserUpdater', function() {
},
'settings-sharelatex': (this.settings = {}),
request: (this.request = {}),
'../Newsletter/NewsletterManager': this.NewsletterManager
'../Newsletter/NewsletterManager': this.NewsletterManager,
'../Subscription/RecurlyWrapper': this.RecurlyWrapper
}
})
@@ -350,6 +352,7 @@ describe('UserUpdater', function() {
]
this.UserGetter.getUser = sinon.stub().yields(null, this.stubbedUser)
this.NewsletterManager.changeEmail.callsArgWith(2, null)
this.RecurlyWrapper.updateAccountEmailAddress.yields(null)
})
it('set default', function(done) {
@@ -382,6 +385,9 @@ describe('UserUpdater', function() {
this.NewsletterManager.changeEmail
.calledWith(this.stubbedUser, this.newEmail)
.should.equal(true)
this.RecurlyWrapper.updateAccountEmailAddress
.calledWith(this.stubbedUser._id, this.newEmail)
.should.equal(true)
done()
}
)