From d21eb1b07f0edbc91d6a1f6827416265ca5b9a9b Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Tue, 28 Jun 2016 09:04:19 +0100 Subject: [PATCH] Add tests --- .../Subscription/RecurlyWrapperTests.coffee | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/services/web/test/UnitTests/coffee/Subscription/RecurlyWrapperTests.coffee b/services/web/test/UnitTests/coffee/Subscription/RecurlyWrapperTests.coffee index e9dae2cd66..02450ea984 100644 --- a/services/web/test/UnitTests/coffee/Subscription/RecurlyWrapperTests.coffee +++ b/services/web/test/UnitTests/coffee/Subscription/RecurlyWrapperTests.coffee @@ -590,25 +590,21 @@ describe "RecurlyWrapper", -> {user, subscriptionDetails, recurly_token_id, userExists: false, account: {accountCode: 'xx'}} ) - @createAccount.callsArgWith(1, null, {user, subscriptionDetails, recurly_token_id, userExists: false, account: {accountCode: 'xx'}} ) - @createBillingInfo.callsArgWith(1, null, {user, subscriptionDetails, recurly_token_id, userExists: false, account: {accountCode: 'xx'}, billingInfo: {token_id: 'abc'}} ) - @setAddress.callsArgWith(1, null, {user, subscriptionDetails, recurly_token_id, userExists: false, account: {accountCode: 'xx'}, billingInfo: {token_id: 'abc'}} ) - @createSubscription.callsArgWith(1, null, {user, subscriptionDetails, recurly_token_id, - userExists: false, account: {accountCode: 'xx'}, billingInfo: {token_id: 'abc'}, subscription: {}} + userExists: false, account: {accountCode: 'xx'}, billingInfo: {token_id: 'abc'}, subscription: @subscription} ) @call = (callback) => @@ -625,3 +621,18 @@ describe "RecurlyWrapper", -> @call (err, sub) => expect(err).to.not.be.instanceof Error done() + + it 'should produce a subscription object', (done) -> + @call (err, sub) => + expect(sub).to.not.equal null + expect(sub).to.equal @subscription + done() + + it 'should call each of the paypal functions', (done) -> + @call (err, sub) => + @checkAccountExists.callCount.should.equal 1 + @createAccount.callCount.should.equal 1 + @createBillingInfo.callCount.should.equal 1 + @setAddress.callCount.should.equal 1 + @createSubscription.callCount.should.equal 1 + done()