|
|
@@ -183,8 +183,6 @@ describe "SubscriptionUpdater", ->
|
|
|
|
|
|
describe "_setUsersMinimumFeatures", ->
|
|
|
|
|
|
-
|
|
|
-
|
|
|
it "should call updateFeatures with the subscription if set", (done)->
|
|
|
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, @subscription)
|
|
|
@SubscriptionLocator.getGroupSubscriptionMemberOf.callsArgWith(1, null)
|
|
|
@@ -205,6 +203,16 @@ describe "SubscriptionUpdater", ->
|
|
|
assert.equal args[1], @groupSubscription.planCode
|
|
|
done()
|
|
|
|
|
|
+ it "should call not call updateFeatures with users subscription if the subscription plan code is the default one (downgraded)", (done)->
|
|
|
+ @subscription.planCode = @Settings.defaultPlanCode
|
|
|
+ @SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, @subscription)
|
|
|
+ @SubscriptionLocator.getGroupSubscriptionMemberOf.callsArgWith(1, null, @groupSubscription)
|
|
|
+ @SubscriptionUpdater._setUsersMinimumFeatures @adminuser_id, (err)=>
|
|
|
+ args = @UserFeaturesUpdater.updateFeatures.args[0]
|
|
|
+ assert.equal args[0], @adminUser._id
|
|
|
+ assert.equal args[1], @groupSubscription.planCode
|
|
|
+ done()
|
|
|
+
|
|
|
|
|
|
it "should call updateFeatures with default if there are no subscriptions for user", (done)->
|
|
|
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null)
|