diff --git a/test/regression/models/model_member_stripe_customer_spec.js b/test/regression/models/model_member_stripe_customer_spec.js index 6887b25e4b..65da36d7f1 100644 --- a/test/regression/models/model_member_stripe_customer_spec.js +++ b/test/regression/models/model_member_stripe_customer_spec.js @@ -15,8 +15,7 @@ describe('MemberStripeCustomer Model', function run() { afterEach(testUtils.teardownDb); describe('subscriptions', function () { - // For some reason the initial .add of MemberStripeCustomer is **not** adding a StripeCustomerSubscription :( - it.skip('Is correctly mapped to the stripe subscriptions', async function () { + it('Is correctly mapped to the stripe subscriptions', async function () { const context = testUtils.context.admin; const member = await Member.add({ @@ -46,31 +45,12 @@ describe('MemberStripeCustomer Model', function run() { await MemberStripeCustomer.add({ member_id: member.get('id'), - customer_id: 'fake_customer_id', - subscriptions: [{ - subscription_id: 'fake_subscription_id1', - plan_id: 'fake_plan_id', - stripe_price_id: 'fake_plan_id', - plan_amount: 1337, - plan_nickname: 'e-LEET', - plan_interval: 'year', - plan_currency: 'btc', - status: 'active', - start_date: new Date(), - current_period_end: new Date(), - cancel_at_period_end: false - }] + customer_id: 'fake_customer_id' }, context); - const subscription1 = await StripeCustomerSubscription.findOne({ - subscription_id: 'fake_subscription_id1' - }, context); - - should.exist(subscription1, 'StripeCustomerSubscription should have been created'); - await StripeCustomerSubscription.add({ customer_id: 'fake_customer_id', - subscription_id: 'fake_subscription_id2', + subscription_id: 'fake_subscription_id', plan_id: 'fake_plan_id', stripe_price_id: 'fake_plan_id', plan_amount: 1337, @@ -93,10 +73,9 @@ describe('MemberStripeCustomer Model', function run() { const subscriptions = customer.related('subscriptions'); - should.equal(subscriptions.length, 2, 'Should be two subscriptions'); + should.equal(subscriptions.length, 1, 'Should be two subscriptions'); - should.equal(subscriptions.models[0].get('subscription_id'), 'fake_subscription_id1'); - should.equal(subscriptions.models[1].get('subscription_id'), 'fake_subscription_id2'); + should.equal(subscriptions.models[0].get('subscription_id'), 'fake_subscription_id'); }); });