diff --git a/ghost/portal/src/components/pages/AccountPlanPage.test.js b/ghost/portal/src/components/pages/AccountPlanPage.test.js index a56af737d9..7608cc59ca 100644 --- a/ghost/portal/src/components/pages/AccountPlanPage.test.js +++ b/ghost/portal/src/components/pages/AccountPlanPage.test.js @@ -1,5 +1,5 @@ import React from 'react'; -import {generateAccountPlanFixture} from '../../utils/fixtures'; +import {generateAccountPlanFixture, getSiteData, getProductsData} from '../../utils/fixtures'; import {render, fireEvent} from '../../utils/test-utils'; import AccountPlanPage from './AccountPlanPage'; @@ -52,7 +52,10 @@ describe('Account Plan Page', () => { }); test('can choose plan and continue', async () => { - const {mockOnActionFn, monthlyCheckboxEl, yearlyCheckboxEl, continueBtn} = setup(); + const siteData = getSiteData({ + products: getProductsData({numOfProducts: 1}) + }); + const {mockOnActionFn, monthlyCheckboxEl, yearlyCheckboxEl, continueBtn} = setup({site: siteData}); fireEvent.click(monthlyCheckboxEl); expect(monthlyCheckboxEl.checked).toEqual(false); fireEvent.click(yearlyCheckboxEl); @@ -60,7 +63,7 @@ describe('Account Plan Page', () => { expect(continueBtn).toBeEnabled(); fireEvent.click(continueBtn); - expect(mockOnActionFn).toHaveBeenCalledWith('checkoutPlan', {plan: '6085adc776909b1a2382369a'}); + expect(mockOnActionFn).toHaveBeenCalledWith('checkoutPlan', {plan: siteData.products[0].monthlyPrice.id}); }); test('can cancel subscription for member on hidden tier', async () => { diff --git a/ghost/portal/src/utils/fixtures.js b/ghost/portal/src/utils/fixtures.js index 33cf22c9e7..7f3b53e916 100644 --- a/ghost/portal/src/utils/fixtures.js +++ b/ghost/portal/src/utils/fixtures.js @@ -97,7 +97,7 @@ function getMemberData({ }; } -function getProductsData({numOfProducts = 3} = {}) { +export function getProductsData({numOfProducts = 3} = {}) { const products = [ getProductData({ name: 'Bronze', @@ -107,7 +107,7 @@ function getProductsData({numOfProducts = 3} = {}) { amount: 700 }), yearlyPrice: getPriceData({ - interval: 'month', + interval: 'year', amount: 7000 }), numOfBenefits: 2 @@ -120,7 +120,7 @@ function getProductsData({numOfProducts = 3} = {}) { amount: 1200 }), yearlyPrice: getPriceData({ - interval: 'month', + interval: 'year', amount: 12000 }), numOfBenefits: 3 @@ -133,7 +133,7 @@ function getProductsData({numOfProducts = 3} = {}) { amount: 2000 }), yearlyPrice: getPriceData({ - interval: 'month', + interval: 'year', amount: 17000 }), numOfBenefits: 4