From 07f1d6d3a5c7aafb8e9c49d122b4ab35b608083a Mon Sep 17 00:00:00 2001 From: Rishabh Date: Thu, 27 May 2021 17:48:24 +0530 Subject: [PATCH] Fixed tests no refs --- ghost/portal/src/components/pages/AccountPlanPage.test.js | 3 ++- ghost/portal/src/utils/fixtures.js | 7 ++++--- ghost/portal/src/utils/helpers.js | 1 + ghost/portal/src/utils/test-utils.js | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ghost/portal/src/components/pages/AccountPlanPage.test.js b/ghost/portal/src/components/pages/AccountPlanPage.test.js index 541f3e0b65..e69d1beb05 100644 --- a/ghost/portal/src/components/pages/AccountPlanPage.test.js +++ b/ghost/portal/src/components/pages/AccountPlanPage.test.js @@ -30,12 +30,13 @@ describe('Account Plan Page', () => { test('can choose plan and continue', async () => { const {mockOnActionFn, monthlyCheckboxEl, yearlyCheckboxEl, continueBtn} = setup(); + fireEvent.click(monthlyCheckboxEl); expect(monthlyCheckboxEl.checked).toEqual(true); fireEvent.click(yearlyCheckboxEl); expect(yearlyCheckboxEl.checked).toEqual(true); expect(continueBtn).toBeEnabled(); fireEvent.click(continueBtn); - expect(mockOnActionFn).toHaveBeenCalledWith('checkoutPlan', {plan: '6086d2c776909b1a2382369a'}); + expect(mockOnActionFn).toHaveBeenCalledWith('checkoutPlan', {plan: '6087c314d3e64b3266bf715e'}); }); }); diff --git a/ghost/portal/src/utils/fixtures.js b/ghost/portal/src/utils/fixtures.js index f79fc64667..f465776cfe 100644 --- a/ghost/portal/src/utils/fixtures.js +++ b/ghost/portal/src/utils/fixtures.js @@ -49,7 +49,7 @@ const prices = [ stripe_product_id: 'prod_JNGGBrrogUXcoM', active: 1, nickname: 'Yearly', - currency: 'aud', + currency: 'usd', amount: 12200, type: 'recurring', interval: 'year' @@ -108,7 +108,7 @@ export const site = { description: 'The default product' }, prices: prices, - allow_self_signup: false, + allow_self_signup: true, members_signup_access: 'all', free_price_name: 'Free', free_price_description: 'Free preview', @@ -265,5 +265,6 @@ export const member = { export const testSite = { ...site, - portal_plans: ['free', 'monthly', 'yearly'] + allow_self_signup: true, + portal_plans: ['free', ...priceIds] }; diff --git a/ghost/portal/src/utils/helpers.js b/ghost/portal/src/utils/helpers.js index a1302ac2a4..532ca5b53d 100644 --- a/ghost/portal/src/utils/helpers.js +++ b/ghost/portal/src/utils/helpers.js @@ -238,6 +238,7 @@ export function getSitePrices({site = {}, includeFree = true, pageQuery = ''} = freePriceCurrencyDetail.currency = stripePrices[0].currency; freePriceCurrencyDetail.currency_symbol = stripePrices[0].currency_symbol; } + if (allowSelfSignup && portalPlans.includes('free') && includeFree) { plansData.push({ id: 'free', diff --git a/ghost/portal/src/utils/test-utils.js b/ghost/portal/src/utils/test-utils.js index ae13bb4957..2dbcb0e9d8 100644 --- a/ghost/portal/src/utils/test-utils.js +++ b/ghost/portal/src/utils/test-utils.js @@ -38,4 +38,4 @@ const customRender = (ui, {options = {}, overrideContext = {}} = {}) => { export * from '@testing-library/react'; // override render method -export {customRender as render}; \ No newline at end of file +export {customRender as render};