Finish unit tests for SubscriptionUpdater

This commit is contained in:
Shane Kilkelly 2017-12-13 10:57:56 +00:00
parent eefe56d0f7
commit 6fe937bcad

View file

@ -209,7 +209,7 @@ describe "SubscriptionUpdater", ->
it "should call updateFeatures with the overleaf subscription if set", (done)->
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null)
@SubscriptionLocator.getGroupSubscriptionMemberOf.callsArgWith(1, null, null)
@Modules.hooks.fire = sinon.stub().callsArgWith(2, null, 'ol_pro')
@Modules.hooks.fire = sinon.stub().callsArgWith(2, null, ['ol_pro'])
@SubscriptionUpdater._setUsersMinimumFeatures @adminUser._id, (err)=>
args = @UserFeaturesUpdater.updateFeatures.args[0]
@ -278,3 +278,13 @@ describe "SubscriptionUpdater", ->
@SubscriptionUpdater._setUsersMinimumFeatures
.calledWith(user_id)
.should.equal true
describe 'refreshSubscription', ->
beforeEach ->
@SubscriptionUpdater._setUsersMinimumFeatures = sinon.stub()
.callsArgWith(1, null)
it 'should call to _setUsersMinimumFeatures', ->
@SubscriptionUpdater.refreshSubscription(@adminUser._id, ()->)
@SubscriptionUpdater._setUsersMinimumFeatures.callCount.should.equal 1
@SubscriptionUpdater._setUsersMinimumFeatures.calledWith(@adminUser._id).should.equal true