mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Finish unit tests for SubscriptionUpdater
This commit is contained in:
parent
eefe56d0f7
commit
6fe937bcad
1 changed files with 11 additions and 1 deletions
|
@ -209,7 +209,7 @@ describe "SubscriptionUpdater", ->
|
||||||
it "should call updateFeatures with the overleaf subscription if set", (done)->
|
it "should call updateFeatures with the overleaf subscription if set", (done)->
|
||||||
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null)
|
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null)
|
||||||
@SubscriptionLocator.getGroupSubscriptionMemberOf.callsArgWith(1, null, 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)=>
|
@SubscriptionUpdater._setUsersMinimumFeatures @adminUser._id, (err)=>
|
||||||
args = @UserFeaturesUpdater.updateFeatures.args[0]
|
args = @UserFeaturesUpdater.updateFeatures.args[0]
|
||||||
|
@ -278,3 +278,13 @@ describe "SubscriptionUpdater", ->
|
||||||
@SubscriptionUpdater._setUsersMinimumFeatures
|
@SubscriptionUpdater._setUsersMinimumFeatures
|
||||||
.calledWith(user_id)
|
.calledWith(user_id)
|
||||||
.should.equal true
|
.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
|
||||||
|
|
Loading…
Reference in a new issue