|
@@ -21,12 +21,14 @@ describe "UserUpdater", ->
|
|
|
@logger = err: sinon.stub(), log: ->
|
|
@logger = err: sinon.stub(), log: ->
|
|
|
@addAffiliation = sinon.stub().yields()
|
|
@addAffiliation = sinon.stub().yields()
|
|
|
@removeAffiliation = sinon.stub().callsArgWith(2, null)
|
|
@removeAffiliation = sinon.stub().callsArgWith(2, null)
|
|
|
|
|
+ @refreshFeatures = sinon.stub().yields()
|
|
|
@UserUpdater = SandboxedModule.require modulePath, requires:
|
|
@UserUpdater = SandboxedModule.require modulePath, requires:
|
|
|
"logger-sharelatex": @logger
|
|
"logger-sharelatex": @logger
|
|
|
"./UserGetter": @UserGetter
|
|
"./UserGetter": @UserGetter
|
|
|
'./UserAffiliationsManager':
|
|
'./UserAffiliationsManager':
|
|
|
addAffiliation: @addAffiliation
|
|
addAffiliation: @addAffiliation
|
|
|
removeAffiliation: @removeAffiliation
|
|
removeAffiliation: @removeAffiliation
|
|
|
|
|
+ '../Subscription/FeaturesUpdater': refreshFeatures: @refreshFeatures
|
|
|
"../../infrastructure/mongojs":@mongojs
|
|
"../../infrastructure/mongojs":@mongojs
|
|
|
"metrics-sharelatex": timeAsyncMethod: sinon.stub()
|
|
"metrics-sharelatex": timeAsyncMethod: sinon.stub()
|
|
|
|
|
|
|
@@ -245,3 +247,9 @@ describe "UserUpdater", ->
|
|
|
should.exist(err)
|
|
should.exist(err)
|
|
|
@UserUpdater.updateUser.called.should.equal false
|
|
@UserUpdater.updateUser.called.should.equal false
|
|
|
done()
|
|
done()
|
|
|
|
|
+
|
|
|
|
|
+ it 'refresh features', (done)->
|
|
|
|
|
+ @UserUpdater.confirmEmail @stubbedUser._id, @newEmail, (err)=>
|
|
|
|
|
+ should.not.exist(err)
|
|
|
|
|
+ sinon.assert.calledWith(@refreshFeatures, @stubbedUser._id, true)
|
|
|
|
|
+ done()
|