|
@@ -32,6 +32,7 @@ describe('UserUpdater', function() {
|
|
|
this.removeAffiliation = sinon.stub().callsArgWith(2, null)
|
|
this.removeAffiliation = sinon.stub().callsArgWith(2, null)
|
|
|
this.refreshFeatures = sinon.stub().yields()
|
|
this.refreshFeatures = sinon.stub().yields()
|
|
|
this.NewsletterManager = { changeEmail: sinon.stub() }
|
|
this.NewsletterManager = { changeEmail: sinon.stub() }
|
|
|
|
|
+ this.RecurlyWrapper = { updateAccountEmailAddress: sinon.stub() }
|
|
|
this.UserUpdater = SandboxedModule.require(modulePath, {
|
|
this.UserUpdater = SandboxedModule.require(modulePath, {
|
|
|
globals: {
|
|
globals: {
|
|
|
console: console
|
|
console: console
|
|
@@ -55,7 +56,8 @@ describe('UserUpdater', function() {
|
|
|
},
|
|
},
|
|
|
'settings-sharelatex': (this.settings = {}),
|
|
'settings-sharelatex': (this.settings = {}),
|
|
|
request: (this.request = {}),
|
|
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.UserGetter.getUser = sinon.stub().yields(null, this.stubbedUser)
|
|
|
this.NewsletterManager.changeEmail.callsArgWith(2, null)
|
|
this.NewsletterManager.changeEmail.callsArgWith(2, null)
|
|
|
|
|
+ this.RecurlyWrapper.updateAccountEmailAddress.yields(null)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
it('set default', function(done) {
|
|
it('set default', function(done) {
|
|
@@ -382,6 +385,9 @@ describe('UserUpdater', function() {
|
|
|
this.NewsletterManager.changeEmail
|
|
this.NewsletterManager.changeEmail
|
|
|
.calledWith(this.stubbedUser, this.newEmail)
|
|
.calledWith(this.stubbedUser, this.newEmail)
|
|
|
.should.equal(true)
|
|
.should.equal(true)
|
|
|
|
|
+ this.RecurlyWrapper.updateAccountEmailAddress
|
|
|
|
|
+ .calledWith(this.stubbedUser._id, this.newEmail)
|
|
|
|
|
+ .should.equal(true)
|
|
|
done()
|
|
done()
|
|
|
}
|
|
}
|
|
|
)
|
|
)
|