Fixed tests

no refs
This commit is contained in:
Rishabh 2021-05-27 17:48:24 +05:30 committed by Rishabh Garg
parent 6f88adf4b4
commit 07f1d6d3a5
4 changed files with 8 additions and 5 deletions

View File

@ -30,12 +30,13 @@ describe('Account Plan Page', () => {
test('can choose plan and continue', async () => { test('can choose plan and continue', async () => {
const {mockOnActionFn, monthlyCheckboxEl, yearlyCheckboxEl, continueBtn} = setup(); const {mockOnActionFn, monthlyCheckboxEl, yearlyCheckboxEl, continueBtn} = setup();
fireEvent.click(monthlyCheckboxEl);
expect(monthlyCheckboxEl.checked).toEqual(true); expect(monthlyCheckboxEl.checked).toEqual(true);
fireEvent.click(yearlyCheckboxEl); fireEvent.click(yearlyCheckboxEl);
expect(yearlyCheckboxEl.checked).toEqual(true); expect(yearlyCheckboxEl.checked).toEqual(true);
expect(continueBtn).toBeEnabled(); expect(continueBtn).toBeEnabled();
fireEvent.click(continueBtn); fireEvent.click(continueBtn);
expect(mockOnActionFn).toHaveBeenCalledWith('checkoutPlan', {plan: '6086d2c776909b1a2382369a'}); expect(mockOnActionFn).toHaveBeenCalledWith('checkoutPlan', {plan: '6087c314d3e64b3266bf715e'});
}); });
}); });

View File

@ -49,7 +49,7 @@ const prices = [
stripe_product_id: 'prod_JNGGBrrogUXcoM', stripe_product_id: 'prod_JNGGBrrogUXcoM',
active: 1, active: 1,
nickname: 'Yearly', nickname: 'Yearly',
currency: 'aud', currency: 'usd',
amount: 12200, amount: 12200,
type: 'recurring', type: 'recurring',
interval: 'year' interval: 'year'
@ -108,7 +108,7 @@ export const site = {
description: 'The default product' description: 'The default product'
}, },
prices: prices, prices: prices,
allow_self_signup: false, allow_self_signup: true,
members_signup_access: 'all', members_signup_access: 'all',
free_price_name: 'Free', free_price_name: 'Free',
free_price_description: 'Free preview', free_price_description: 'Free preview',
@ -265,5 +265,6 @@ export const member = {
export const testSite = { export const testSite = {
...site, ...site,
portal_plans: ['free', 'monthly', 'yearly'] allow_self_signup: true,
portal_plans: ['free', ...priceIds]
}; };

View File

@ -238,6 +238,7 @@ export function getSitePrices({site = {}, includeFree = true, pageQuery = ''} =
freePriceCurrencyDetail.currency = stripePrices[0].currency; freePriceCurrencyDetail.currency = stripePrices[0].currency;
freePriceCurrencyDetail.currency_symbol = stripePrices[0].currency_symbol; freePriceCurrencyDetail.currency_symbol = stripePrices[0].currency_symbol;
} }
if (allowSelfSignup && portalPlans.includes('free') && includeFree) { if (allowSelfSignup && portalPlans.includes('free') && includeFree) {
plansData.push({ plansData.push({
id: 'free', id: 'free',

View File

@ -38,4 +38,4 @@ const customRender = (ui, {options = {}, overrideContext = {}} = {}) => {
export * from '@testing-library/react'; export * from '@testing-library/react';
// override render method // override render method
export {customRender as render}; export {customRender as render};