Skip to content

Commit

Permalink
Update test to add new mock
Browse files Browse the repository at this point in the history
  • Loading branch information
daledupreez committed Jun 25, 2024
1 parent c068b9f commit 11ab266
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ import PlanNotice from 'calypso/my-sites/plans-features-main/components/plan-not
import { usePlanUpgradeCreditsApplicable } from 'calypso/my-sites/plans-features-main/hooks/use-plan-upgrade-credits-applicable';
import { getCurrentUserCurrencyCode } from 'calypso/state/currency-code/selectors';
import { getByPurchaseId } from 'calypso/state/purchases/selectors';
import { isCurrentUserCurrentPlanOwner } from 'calypso/state/sites/plans/selectors';
import {
isCurrentUserCurrentPlanOwner,
isRequestingSitePlans,
} from 'calypso/state/sites/plans/selectors';
import { isCurrentPlanPaid } from 'calypso/state/sites/selectors';
import { renderWithProvider } from 'calypso/test-helpers/testing-library';

Expand All @@ -31,6 +34,7 @@ jest.mock( 'calypso/state/purchases/selectors', () => ( {
} ) );
jest.mock( 'calypso/state/sites/plans/selectors', () => ( {
isCurrentUserCurrentPlanOwner: jest.fn(),
isRequestingSitePlans: jest.fn(),
getCurrentPlan: jest.fn(),
} ) );
jest.mock( 'calypso/state/sites/selectors', () => ( {
Expand Down Expand Up @@ -64,6 +68,9 @@ const mIsCurrentPlanPaid = isCurrentPlanPaid as jest.MockedFunction< typeof isCu
const mIsCurrentUserCurrentPlanOwner = isCurrentUserCurrentPlanOwner as jest.MockedFunction<
typeof isCurrentUserCurrentPlanOwner
>;
const mIsRequestingSitePlans = isRequestingSitePlans as jest.MockedFunction<
typeof isRequestingSitePlans
>;
const mUsePlanUpgradeCreditsApplicable = usePlanUpgradeCreditsApplicable as jest.MockedFunction<
typeof usePlanUpgradeCreditsApplicable
>;
Expand Down Expand Up @@ -95,6 +102,7 @@ describe( '<PlanNotice /> Tests', () => {
mUseMarketingMessage.mockImplementation( () => [ false, [], () => ( {} ) ] );
mIsCurrentPlanPaid.mockImplementation( () => true );
mIsCurrentUserCurrentPlanOwner.mockImplementation( () => true );
mIsRequestingSitePlans.mockImplementation( () => true );
mGetCurrentUserCurrencyCode.mockImplementation( () => 'USD' );
mUsePlanUpgradeCreditsApplicable.mockImplementation( () => 1 );
mGetByPurchaseId.mockImplementation( () => ( { isInAppPurchase: false } ) as Purchase );
Expand Down

0 comments on commit 11ab266

Please sign in to comment.