1
1
/** @jest -environment jsdom */
2
2
3
+ import { isEnabled } from '@automattic/calypso-config' ;
3
4
import {
4
5
PLAN_BUSINESS ,
5
6
PLAN_PREMIUM ,
@@ -67,6 +68,7 @@ jest.mock( 'calypso/my-sites/plans-features-main/hooks/use-max-plan-upgrade-cred
67
68
jest . mock ( 'calypso/state/currency-code/selectors' , ( ) => ( {
68
69
getCurrentUserCurrencyCode : jest . fn ( ) ,
69
70
} ) ) ;
71
+ jest . mock ( '@automattic/calypso-config' ) ;
70
72
71
73
const mGetDiscountByName = getDiscountByName as jest . MockedFunction < typeof getDiscountByName > ;
72
74
const mUseMarketingMessage = useMarketingMessage as jest . MockedFunction <
@@ -90,6 +92,7 @@ const mGetCurrentUserCurrencyCode = getCurrentUserCurrencyCode as jest.MockedFun
90
92
> ;
91
93
const mGetByPurchaseId = getByPurchaseId as jest . MockedFunction < typeof getByPurchaseId > ;
92
94
const mIsProPlan = isProPlan as jest . MockedFunction < typeof isProPlan > ;
95
+ const mIsEnabled = isEnabled as jest . MockedFunction < typeof isEnabled > ;
93
96
94
97
const plansList : PlanSlug [ ] = [
95
98
PLAN_FREE ,
@@ -119,6 +122,7 @@ describe( '<PlanNotice /> Tests', () => {
119
122
mUseDomainToPlanCreditsApplicable . mockImplementation ( ( ) => 100 ) ;
120
123
mGetByPurchaseId . mockImplementation ( ( ) => ( { isInAppPurchase : false } ) as Purchase ) ;
121
124
mIsProPlan . mockImplementation ( ( ) => false ) ;
125
+ mIsEnabled . mockImplementation ( ( key ) => key !== 'domain-to-plan-credit' ) ;
122
126
} ) ;
123
127
124
128
test ( 'A contact site owner <PlanNotice /> should be shown no matter what other conditions are met, when the current site owner is not logged in, and the site plan is paid' , ( ) => {
@@ -179,6 +183,7 @@ describe( '<PlanNotice /> Tests', () => {
179
183
test ( 'A domain-to-plan credit <PlanNotice /> should be shown in a site where a domain has been purchased without a paid plan' , ( ) => {
180
184
mUsePlanUpgradeCreditsApplicable . mockImplementation ( ( ) => null ) ;
181
185
mUseDomainToPlanCreditsApplicable . mockImplementation ( ( ) => 1000 ) ;
186
+ mIsEnabled . mockImplementation ( ( key ) => key === 'domain-to-plan-credit' ) ;
182
187
183
188
renderWithProvider (
184
189
< PlanNotice
0 commit comments