From 6fe937bcadcc9ff895381785e88f9cda8f39fcf4 Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Wed, 13 Dec 2017 10:57:56 +0000 Subject: [PATCH] Finish unit tests for SubscriptionUpdater --- .../Subscription/SubscriptionUpdaterTests.coffee | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/services/web/test/unit/coffee/Subscription/SubscriptionUpdaterTests.coffee b/services/web/test/unit/coffee/Subscription/SubscriptionUpdaterTests.coffee index 3f25465ae0..93479a03a1 100644 --- a/services/web/test/unit/coffee/Subscription/SubscriptionUpdaterTests.coffee +++ b/services/web/test/unit/coffee/Subscription/SubscriptionUpdaterTests.coffee @@ -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