From a0a4db03874527591ea3f6e994353727b24cf3cd Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Mon, 23 Dec 2024 13:34:35 -0800 Subject: [PATCH 1/5] initial updates, including test fixes for useAvailablePlans. Only expose isTeamPlan and isSentryPlan --- .../CancelPlanPage/CancelPlanPage.test.tsx | 8 ++++++ .../TeamPlanCard/TeamPlanCard.test.tsx | 14 ++++++++++ .../FreePlanCard/FreePlanCard.test.jsx | 18 +++++++++++++ .../PlanUpgradeTeam/PlanUpgradeTeam.test.jsx | 14 ++++++++++ .../ActionsBilling/ActionsBilling.test.jsx | 12 +++++++++ .../PlanDetailsControls.test.tsx | 12 +++++++++ .../ProPlanDetails/ProPlanDetails.test.jsx | 14 ++++++++++ .../SentryPlanDetails.test.jsx | 14 ++++++++++ .../TeamPlanDetails/TeamPlanDetails.test.jsx | 10 +++++++ .../UpgradeDetails/UpgradeDetails.tsx | 8 ++---- .../UpgradeForm/Controllers/Controller.tsx | 8 ++---- .../BillingOptions/BillingOptions.test.tsx | 6 +++++ .../PriceCallout/PriceCallout.test.tsx | 10 +++++++ .../ProPlanController.test.tsx | 8 ++++++ .../BillingOptions/BillingOptions.test.tsx | 6 +++++ .../PriceCallout/PriceCallout.test.tsx | 6 +++++ .../SentryPlanController.test.tsx | 7 +++++ .../BillingOptions/BillingOptions.test.tsx | 6 +++++ .../ErrorBanner/ErrorBanner.test.tsx | 8 ++++++ .../PriceCallout/PriceCallout.test.tsx | 8 ++++++ .../TeamPlanController.test.tsx | 8 ++++++ .../PlanTypeOptions/PlanTypeOptions.test.tsx | 16 +++++++++++ .../PlanTypeOptions/PlanTypeOptions.tsx | 7 +---- .../UpgradeForm/UpdateBlurb/UpdateBlurb.tsx | 5 ++-- .../UpdateButton/UpdateButton.test.tsx | 6 +++++ .../UpgradeForm/UpgradeForm.test.tsx | 16 +++++++++++ .../UpgradeForm/UpgradeForm.tsx | 10 ++----- .../UpgradePlanPage/UpgradePlanPage.test.jsx | 18 +++++++++++++ .../account/useAvailablePlans.test.tsx | 14 ++++++++++ src/services/account/useAvailablePlans.ts | 2 ++ src/services/account/usePlanData.ts | 2 ++ src/shared/utils/upgradeForm.ts | 27 +++++-------------- 32 files changed, 279 insertions(+), 49 deletions(-) diff --git a/src/pages/PlanPage/subRoutes/CancelPlanPage/CancelPlanPage.test.tsx b/src/pages/PlanPage/subRoutes/CancelPlanPage/CancelPlanPage.test.tsx index 778c81621b..0f76168a3d 100644 --- a/src/pages/PlanPage/subRoutes/CancelPlanPage/CancelPlanPage.test.tsx +++ b/src/pages/PlanPage/subRoutes/CancelPlanPage/CancelPlanPage.test.tsx @@ -24,6 +24,8 @@ const teamPlans = [ marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, }, { baseUnitPrice: 5, @@ -32,6 +34,8 @@ const teamPlans = [ marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, }, ] @@ -47,6 +51,8 @@ const mockAvailablePlans = ({ hasTeamPlans }: { hasTeamPlans: boolean }) => [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -60,6 +66,8 @@ const mockAvailablePlans = ({ hasTeamPlans }: { hasTeamPlans: boolean }) => [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, ...(hasTeamPlans ? teamPlans : []), ] diff --git a/src/pages/PlanPage/subRoutes/CancelPlanPage/subRoutes/TeamPlanSpecialOffer/TeamPlanCard/TeamPlanCard.test.tsx b/src/pages/PlanPage/subRoutes/CancelPlanPage/subRoutes/TeamPlanSpecialOffer/TeamPlanCard/TeamPlanCard.test.tsx index f6509c6b3b..1a5bf50383 100644 --- a/src/pages/PlanPage/subRoutes/CancelPlanPage/subRoutes/TeamPlanSpecialOffer/TeamPlanCard/TeamPlanCard.test.tsx +++ b/src/pages/PlanPage/subRoutes/CancelPlanPage/subRoutes/TeamPlanSpecialOffer/TeamPlanCard/TeamPlanCard.test.tsx @@ -22,6 +22,8 @@ const mockAvailablePlans = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -35,6 +37,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -48,6 +52,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -61,6 +67,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -74,6 +82,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { baseUnitPrice: 6, @@ -82,6 +92,8 @@ const mockAvailablePlans = [ marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, }, { baseUnitPrice: 5, @@ -90,6 +102,8 @@ const mockAvailablePlans = [ marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, }, ] diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.test.jsx index e5cfdfb190..208135af94 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.test.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.test.jsx @@ -28,6 +28,8 @@ const allPlans = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -41,6 +43,8 @@ const allPlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -54,6 +58,8 @@ const allPlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -67,6 +73,8 @@ const allPlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -80,6 +88,8 @@ const allPlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { baseUnitPrice: 6, @@ -88,6 +98,8 @@ const allPlans = [ marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, }, { baseUnitPrice: 5, @@ -96,6 +108,8 @@ const allPlans = [ marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, }, ] @@ -107,6 +121,8 @@ const sentryPlans = [ baseUnitPrice: 0, benefits: ['Includes 5 seats', 'Unlimited public repositories'], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: true, }, { marketingName: 'Sentry', @@ -115,6 +131,8 @@ const sentryPlans = [ baseUnitPrice: 10, benefits: ['Includes 5 seats', 'Unlimited private repositories'], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: true, }, ] diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/PlanUpgradeTeam/PlanUpgradeTeam.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/PlanUpgradeTeam/PlanUpgradeTeam.test.jsx index 5b2be1db6e..91e85a105e 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/PlanUpgradeTeam/PlanUpgradeTeam.test.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/PlanUpgradeTeam/PlanUpgradeTeam.test.jsx @@ -87,6 +87,8 @@ const mockAvailablePlans = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -100,6 +102,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -113,6 +117,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -126,6 +132,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -139,6 +147,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { baseUnitPrice: 6, @@ -147,6 +157,8 @@ const mockAvailablePlans = [ marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, }, { baseUnitPrice: 5, @@ -155,6 +167,8 @@ const mockAvailablePlans = [ marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, }, ] diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx index 0fc1b05d6a..625312652c 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx @@ -34,6 +34,8 @@ const allPlans = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -47,6 +49,8 @@ const allPlans = [ 'Priorty Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -60,6 +64,8 @@ const allPlans = [ 'Priorty Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -73,6 +79,8 @@ const allPlans = [ 'Priorty Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -86,6 +94,8 @@ const allPlans = [ 'Priorty Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, ] @@ -97,6 +107,8 @@ const sentryPlans = [ monthlyUploadLimit: null, value: Plans.USERS_SENTRYM, billingRate: BillingRate.MONTHLY, + isTeamPlan: false, + isSentryPlan: true, }, ] diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/PlanDetailsControls/PlanDetailsControls.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/PlanDetailsControls/PlanDetailsControls.test.tsx index b4ffee777f..bc1282ddab 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/PlanDetailsControls/PlanDetailsControls.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/PlanDetailsControls/PlanDetailsControls.test.tsx @@ -22,6 +22,8 @@ const proPlanMonth = { 'Priority Support', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, } const proPlanYear = { @@ -36,6 +38,8 @@ const proPlanYear = { 'Priority Support', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, } const sentryPlanMonth = { @@ -50,6 +54,8 @@ const sentryPlanMonth = { 'Priority Support', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: true, } const sentryPlanYear = { @@ -64,6 +70,8 @@ const sentryPlanYear = { 'Priority Support', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: true, } const teamPlanMonth = { @@ -73,6 +81,8 @@ const teamPlanMonth = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, } const teamPlanYear = { @@ -82,6 +92,8 @@ const teamPlanYear = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, } const server = setupServer() diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx index 015a37aa14..dfbf4ba9d0 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx @@ -28,6 +28,8 @@ const proPlanYear = { ], quantity: 10, monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, } const sentryPlanMonth = { @@ -43,6 +45,8 @@ const sentryPlanMonth = { ], trialDays: 14, monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: true, } const sentryPlanYear = { @@ -58,6 +62,8 @@ const sentryPlanYear = { ], monthlyUploadLimit: null, trialDays: 14, + isTeamPlan: false, + isSentryPlan: true, } const allPlansWithoutSentry = [ @@ -72,6 +78,8 @@ const allPlansWithoutSentry = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro', @@ -85,6 +93,8 @@ const allPlansWithoutSentry = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, proPlanYear, { @@ -99,6 +109,8 @@ const allPlansWithoutSentry = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro', @@ -112,6 +124,8 @@ const allPlansWithoutSentry = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, ] diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx index b22e8a65b6..9ef3b00f8f 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx @@ -25,6 +25,8 @@ const sentryPlanMonth = { ], trialDays: 14, monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: true, } const sentryPlanYear = { @@ -40,6 +42,8 @@ const sentryPlanYear = { ], monthlyUploadLimit: null, trialDays: 14, + isTeamPlan: false, + isSentryPlan: true, } const allPlans = [ @@ -54,6 +58,8 @@ const allPlans = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro', @@ -67,6 +73,8 @@ const allPlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro', @@ -81,6 +89,8 @@ const allPlans = [ ], quantity: 10, monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro', @@ -94,6 +104,8 @@ const allPlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro', @@ -107,6 +119,8 @@ const allPlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, sentryPlanMonth, sentryPlanYear, diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx index 29130bedca..57d3bfec96 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx @@ -22,6 +22,8 @@ const teamPlanMonth = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, } const teamPlanYear = { @@ -31,6 +33,8 @@ const teamPlanYear = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, } const allPlans = [ @@ -45,6 +49,8 @@ const allPlans = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro', @@ -58,6 +64,8 @@ const allPlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro', @@ -72,6 +80,8 @@ const allPlans = [ ], quantity: 10, monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, teamPlanMonth, teamPlanYear, diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.tsx index eb762823f5..36060c7add 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.tsx @@ -1,17 +1,13 @@ import { IndividualPlan } from 'services/account' -import { isSentryPlan, Plans } from 'shared/utils/billing' import ProPlanDetails from './ProPlanDetails' import SentryPlanDetails from './SentryPlanDetails' import TeamPlanDetails from './TeamPlanDetails' function UpgradeDetails({ selectedPlan }: { selectedPlan: IndividualPlan }) { - if (isSentryPlan(selectedPlan.value)) { + if (selectedPlan.isSentryPlan) { return - } else if ( - selectedPlan?.value === Plans.USERS_TEAMM || - selectedPlan?.value === Plans.USERS_TEAMY - ) { + } else if (selectedPlan.isTeamPlan) { return } else { return diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.tsx index 5153407e3c..bab642591c 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.tsx @@ -1,7 +1,6 @@ import { UseFormRegister, UseFormSetValue } from 'react-hook-form' import { IndividualPlan } from 'services/account' -import { isSentryPlan, Plans } from 'shared/utils/billing' import ProPlanController from './ProPlanController' import SentryPlanController from './SentryPlanController' @@ -30,10 +29,7 @@ const Controller: React.FC = ({ setFormValue, setSelectedPlan, }) => { - if ( - newPlan?.value === Plans.USERS_TEAMM || - newPlan?.value === Plans.USERS_TEAMY - ) { + if (newPlan?.isTeamPlan) { return ( = ({ errors={errors} /> ) - } else if (isSentryPlan(newPlan?.value)) { + } else if (newPlan?.isSentryPlan) { return ( = ({ const monthlyPlan = newPlan?.billingRate === BillingRate.MONTHLY let planOption = null - if ( - (hasTeamPlans && planParam === TierNames.TEAM) || - newPlan?.value === Plans.USERS_TEAMM || - newPlan?.value === Plans.USERS_TEAMY - ) { + if ((hasTeamPlans && planParam === TierNames.TEAM) || newPlan?.isTeamPlan) { planOption = TierName.TEAM } else { planOption = TierName.PRO diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.tsx index 9b3d060112..a79172666e 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.tsx @@ -1,5 +1,5 @@ import { IndividualPlan, Plan } from 'services/account' -import { BillingRate, Plans } from 'shared/utils/billing' +import { BillingRate } from 'shared/utils/billing' const UpdateBlurb = ({ currentPlan, @@ -14,8 +14,7 @@ const UpdateBlurb = ({ }) => { const currentIsFree = currentPlan?.isFreePlan const currentIsTeam = currentPlan?.isTeamPlan - const selectedIsTeam = - newPlan?.value === Plans.USERS_TEAMM || newPlan?.value === Plans.USERS_TEAMY + const selectedIsTeam = newPlan?.isTeamPlan const diffPlanType = currentIsFree || currentIsTeam !== selectedIsTeam const currentIsAnnual = currentPlan?.billingRate === BillingRate.ANNUALLY diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx index a9837b5b14..c8d52e889c 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx @@ -22,6 +22,8 @@ const freePlan = { 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, } const proPlanMonthly = { @@ -36,6 +38,8 @@ const proPlanMonthly = { 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, } const proPlanYearly = { @@ -50,6 +54,8 @@ const proPlanYearly = { 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, } const server = setupServer() diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx index 3dbe578316..371afe8079 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx @@ -38,6 +38,8 @@ const basicPlan = { 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, } const proPlanMonth = { @@ -53,6 +55,8 @@ const proPlanMonth = { ], quantity: 10, monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, } const proPlanYear = { @@ -68,6 +72,8 @@ const proPlanYear = { ], monthlyUploadLimit: null, quantity: 13, + isTeamPlan: false, + isSentryPlan: false, } const sentryPlanMonth = { @@ -84,6 +90,8 @@ const sentryPlanMonth = { monthlyUploadLimit: null, trialDays: 14, quantity: 10, + isTeamPlan: false, + isSentryPlan: true, } const sentryPlanYear = { @@ -100,6 +108,8 @@ const sentryPlanYear = { monthlyUploadLimit: null, trialDays: 14, quantity: 21, + isTeamPlan: false, + isSentryPlan: true, } const teamPlanMonth = { @@ -109,6 +119,8 @@ const teamPlanMonth = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, } const teamPlanYear = { @@ -118,6 +130,8 @@ const teamPlanYear = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, } const trialPlan = { @@ -127,6 +141,8 @@ const trialPlan = { baseUnitPrice: 12, benefits: ['Configurable # of users', 'Unlimited repos'], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, } const mockAccountDetailsBasic = { diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.tsx index 08f60b1128..43d3245786 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.tsx @@ -9,11 +9,7 @@ import { useAvailablePlans, usePlanData, } from 'services/account' -import { - canApplySentryUpgrade, - getNextBillingDate, - Plans, -} from 'shared/utils/billing' +import { canApplySentryUpgrade, getNextBillingDate } from 'shared/utils/billing' import { getDefaultValuesUpgradeForm, getSchema, @@ -53,9 +49,7 @@ function UpgradeForm({ selectedPlan, setSelectedPlan }: UpgradeFormProps) { plans, }) const minSeats = - isSentryUpgrade && - selectedPlan?.value !== Plans.USERS_TEAMM && - selectedPlan?.value !== Plans.USERS_TEAMY + isSentryUpgrade && !selectedPlan?.isTeamPlan ? MIN_SENTRY_SEATS : MIN_NB_SEATS_PRO diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx index 12b0c4f17b..77b5382393 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx @@ -29,6 +29,8 @@ const plans = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -42,6 +44,8 @@ const plans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -55,6 +59,8 @@ const plans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -68,6 +74,8 @@ const plans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -81,6 +89,8 @@ const plans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, ] @@ -97,6 +107,8 @@ const sentryPlanMonth = { ], monthlyUploadLimit: null, trialDays: 14, + isTeamPlan: false, + isSentryPlan: true, } const sentryPlanYear = { @@ -112,6 +124,8 @@ const sentryPlanYear = { ], monthlyUploadLimit: null, trialDays: 14, + isTeamPlan: false, + isSentryPlan: true, } const teamPlanMonth = { @@ -121,6 +135,8 @@ const teamPlanMonth = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, } const teamPlanYear = { @@ -130,6 +146,8 @@ const teamPlanYear = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, } const mockPlanData = { diff --git a/src/services/account/useAvailablePlans.test.tsx b/src/services/account/useAvailablePlans.test.tsx index 66d5c1cca8..eed1f1e2c4 100644 --- a/src/services/account/useAvailablePlans.test.tsx +++ b/src/services/account/useAvailablePlans.test.tsx @@ -19,6 +19,8 @@ const mockAvailablePlans = [ 'Unlimited private repositories', ], monthlyUploadLimit: 250, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -32,6 +34,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -45,6 +49,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Sentry Pro Team', @@ -58,6 +64,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: true, }, { marketingName: 'Pro Team', @@ -71,6 +79,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Pro Team', @@ -84,6 +94,8 @@ const mockAvailablePlans = [ 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, }, { marketingName: 'Team', @@ -92,6 +104,8 @@ const mockAvailablePlans = [ baseUnitPrice: 6, benefits: ['Patch coverage analysis'], monthlyUploadLimit: null, + isTeamPlan: true, + isSentryPlan: false, }, ] diff --git a/src/services/account/useAvailablePlans.ts b/src/services/account/useAvailablePlans.ts index 591fce58ce..709882d08a 100644 --- a/src/services/account/useAvailablePlans.ts +++ b/src/services/account/useAvailablePlans.ts @@ -8,6 +8,8 @@ const IndividualPlanSchema = z.object({ baseUnitPrice: z.number(), benefits: z.array(z.string()), billingRate: z.nativeEnum(BillingRate).nullish(), + isTeamPlan: z.boolean(), + isSentryPlan: z.boolean(), marketingName: z.string(), monthlyUploadLimit: z.number().nullable(), value: z.nativeEnum(Plans), diff --git a/src/services/account/usePlanData.ts b/src/services/account/usePlanData.ts index b44ab9e291..3b1c2a85b4 100644 --- a/src/services/account/usePlanData.ts +++ b/src/services/account/usePlanData.ts @@ -32,6 +32,7 @@ const PlanSchema = z.object({ isProPlan: z.boolean(), isTeamPlan: z.boolean(), isTrialPlan: z.boolean(), + isSentryPlan: z.boolean(), }) export type Plan = z.infer @@ -88,6 +89,7 @@ export const query = ` isEnterprisePlan isFreePlan isProPlan + isSentryPlan isTeamPlan isTrialPlan } diff --git a/src/shared/utils/upgradeForm.ts b/src/shared/utils/upgradeForm.ts index 312baed038..f70d3bf632 100644 --- a/src/shared/utils/upgradeForm.ts +++ b/src/shared/utils/upgradeForm.ts @@ -15,8 +15,6 @@ import { findSentryPlans, findTeamPlans, isSentryPlan, - PlanName, - Plans, } from 'shared/utils/billing' export const MIN_NB_SEATS_PRO = 2 @@ -28,20 +26,20 @@ export const UPGRADE_FORM_TOO_MANY_SEATS_MESSAGE = `Team plan is only available export function extractSeats({ quantity, - value, activatedUserCount = 0, inactiveUserCount = 0, isSentryUpgrade, trialStatus, isFreePlan, + isTrialPlan, }: { quantity: number - value?: PlanName activatedUserCount?: number inactiveUserCount?: number isSentryUpgrade: boolean trialStatus?: TrialStatus isFreePlan?: boolean + isTrialPlan?: boolean }) { const totalMembers = inactiveUserCount + activatedUserCount const minPlansSeats = isSentryUpgrade ? MIN_SENTRY_SEATS : MIN_NB_SEATS_PRO @@ -50,7 +48,7 @@ export function extractSeats({ // if their on trial their seat count is around 1000 so this resets the // value to the minium value they would be going on if sentry or pro - if (trialStatus === TrialStatuses.ONGOING && value === Plans.USERS_TRIAL) { + if (trialStatus === TrialStatuses.ONGOING && isTrialPlan) { return minPlansSeats } @@ -81,21 +79,14 @@ export const getSchema = ({ message: `You cannot purchase a per user plan for less than ${minSeats} users`, }) .transform((val, ctx) => { - if ( - (selectedPlan?.value === Plans.USERS_TEAMM || - selectedPlan?.value === Plans.USERS_TEAMY) && - val > TEAM_PLAN_MAX_ACTIVE_USERS - ) { + if (selectedPlan?.isTeamPlan && val > TEAM_PLAN_MAX_ACTIVE_USERS) { ctx.addIssue({ code: z.ZodIssueCode.custom, message: UPGRADE_FORM_TOO_MANY_SEATS_MESSAGE, }) } - if ( - trialStatus === TrialStatuses.ONGOING && - plan?.value === Plans.USERS_TRIAL - ) { + if (trialStatus === TrialStatuses.ONGOING && plan?.isTrialPlan) { return val } @@ -242,24 +233,20 @@ export const getDefaultValuesUpgradeForm = ({ let newPlan = proPlanYear if (isSentryUpgrade && !isSentryPlan(plan?.value)) { newPlan = isMonthlyPlan ? sentryPlanMonth : sentryPlanYear - } else if ( - plan?.isTeamPlan || - selectedPlan?.value === Plans.USERS_TEAMM || - selectedPlan?.value === Plans.USERS_TEAMY - ) { + } else if (plan?.isTeamPlan || selectedPlan?.isTeamPlan) { newPlan = isMonthlyPlan ? teamPlanMonth : teamPlanYear } else if (isPaidPlan) { newPlan = plan } const seats = extractSeats({ - value: plan?.value, quantity: plan?.planUserCount ?? 0, activatedUserCount, inactiveUserCount, trialStatus, isSentryUpgrade, isFreePlan: plan?.isFreePlan, + isTrialPlan: plan?.isTrialPlan, }) return { From ffb3f927ac95c736ce467067b19a35426ca6a14d Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Mon, 23 Dec 2024 13:50:29 -0800 Subject: [PATCH 2/5] remove isSentryPlan references and clean up a few more mocks --- .../FreePlanCard/FreePlanCard.jsx | 3 - .../PaidPlanCard/PaidPlanCard.tsx | 9 +- .../shared/ActionsBilling/ActionsBilling.jsx | 4 +- .../shared/PlanPricing/PlanPricing.jsx | 7 +- .../shared/PlanPricing/PlanPricing.test.jsx | 136 +++++------------- src/shared/utils/billing.test.ts | 62 +++++--- src/shared/utils/billing.ts | 8 -- src/shared/utils/upgradeForm.ts | 3 +- 8 files changed, 85 insertions(+), 147 deletions(-) diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx index 61bb7a7673..5d4a620a33 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.jsx @@ -40,13 +40,11 @@ function FreePlanCard({ plan, scheduledPhase }) { planData?.plan?.trialStatus === TrialStatuses.ONGOING let benefits = plan?.benefits - let planValue = plan?.value let baseUnitPrice = plan?.baseUnitPrice let marketingName = plan?.marketingName if (trialOngoing) { benefits = planData?.pretrialPlan?.benefits - planValue = planData?.pretrialPlan?.value baseUnitPrice = planData?.pretrialPlan?.baseUnitPrice marketingName = planData?.pretrialPlan?.marketingName } @@ -77,7 +75,6 @@ function FreePlanCard({ plan, scheduledPhase }) {
diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.tsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.tsx index 464d7506e9..7da63d9407 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.tsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.tsx @@ -30,7 +30,6 @@ function PaidPlanCard() { const plan = planData?.plan const marketingName = plan?.marketingName const benefits = plan?.benefits - const value = plan?.value const baseUnitPrice = plan?.baseUnitPrice const seats = plan?.planUserCount const numberOfUploads = ownerData?.numberOfUploads @@ -57,12 +56,8 @@ function PaidPlanCard() {

Pricing

- {value && baseUnitPrice ? ( - + {baseUnitPrice ? ( + ) : null} {seats ? (

diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx index 440b0ef4a2..8c06044699 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.jsx @@ -8,7 +8,7 @@ import { usePlanData, } from 'services/account' import { useStartTrial } from 'services/trial' -import { canApplySentryUpgrade, isSentryPlan } from 'shared/utils/billing' +import { canApplySentryUpgrade } from 'shared/utils/billing' import A from 'ui/A/A' import Button from 'ui/Button' @@ -56,7 +56,7 @@ function PlansActionsBilling() { return (

) diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx index 2caa10e18a..a900c46fe2 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.jsx @@ -1,10 +1,8 @@ import PropTypes from 'prop-types' -import { isSentryPlan } from 'shared/utils/billing' - const SENTRY_PRICE = 29 -function PlanPricing({ plan, value, baseUnitPrice }) { +function PlanPricing({ plan, baseUnitPrice }) { if (plan?.isFreePlan) { return

Free

} @@ -13,7 +11,7 @@ function PlanPricing({ plan, value, baseUnitPrice }) { return

Custom pricing

} - if (isSentryPlan(value)) { + if (plan?.isSentryPlan) { return

${SENTRY_PRICE}

} @@ -27,7 +25,6 @@ function PlanPricing({ plan, value, baseUnitPrice }) { PlanPricing.propTypes = { plan: PropTypes.object.isRequired, - value: PropTypes.string.isRequired, baseUnitPrice: PropTypes.number.isRequired, } diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.test.jsx index 3d9854a479..3f9ce2bc1d 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.test.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/PlanPricing/PlanPricing.test.jsx @@ -1,7 +1,5 @@ import { render, screen } from '@testing-library/react' -import { Plans } from 'shared/utils/billing' - import PlanPricing from './PlanPricing' describe('PlanPricing', () => { @@ -9,8 +7,11 @@ describe('PlanPricing', () => { it('renders price is free', () => { render( ) @@ -20,116 +21,57 @@ describe('PlanPricing', () => { }) }) - describe('user is on a basic plan', () => { - it('renders price is free', () => { + describe('user is on a pro plan', () => { + it('renders the base unit price', () => { render( ) - const price = screen.getByText('Free') + const price = screen.getByText('$12') expect(price).toBeInTheDocument() }) }) - describe('user is on a pro plan', () => { - describe('monthly pro plan', () => { - describe('old pro plan', () => { - it('renders the base unit price', () => { - render() - - const price = screen.getByText('$12') - expect(price).toBeInTheDocument() - }) - }) - - describe('new pro plan', () => { - it('renders the base unit price', () => { - render( - - ) - - const price = screen.getByText('$12') - expect(price).toBeInTheDocument() - }) - }) - }) - - describe('annual pro plan', () => { - describe('old pro plan', () => { - it('renders the base unit price', () => { - render() - - const price = screen.getByText('$10') - expect(price).toBeInTheDocument() - }) - }) - - describe('new pro plan', () => { - it('renders the base unit price', () => { - render( - - ) - - const price = screen.getByText('$10') - expect(price).toBeInTheDocument() - }) - }) - }) - }) - describe('users is on an enterprise plan', () => { - describe('enterprise plan is monthly', () => { - it('renders custom pricing', () => { - render( - - ) - - const price = screen.getByText('Custom pricing') - expect(price).toBeInTheDocument() - }) - }) - - describe('enterprise plan is yearly', () => { - it('renders custom pricing', () => { - render( - - ) + it('renders custom pricing', () => { + render( + + ) - const price = screen.getByText('Custom pricing') - expect(price).toBeInTheDocument() - }) + const price = screen.getByText('Custom pricing') + expect(price).toBeInTheDocument() }) }) describe('user is on a sentry plan', () => { - describe('annual sentry plan', () => { - it('renders the base unit price', () => { - render() - - const basePrice = screen.getByText(/\$29/) - expect(basePrice).toBeInTheDocument() - }) - }) - - describe('monthly sentry plan', () => { - it('renders the base unit price', () => { - render() + it('renders the base unit price', () => { + render( + + ) - const price = screen.getByText(/\$29/) - expect(price).toBeInTheDocument() - }) + const price = screen.getByText(/\$29/) + expect(price).toBeInTheDocument() }) }) }) diff --git a/src/shared/utils/billing.test.ts b/src/shared/utils/billing.test.ts index 3091913eb7..8f5ef40879 100644 --- a/src/shared/utils/billing.test.ts +++ b/src/shared/utils/billing.test.ts @@ -9,7 +9,6 @@ import { formatNumberToUSD, formatTimestampToCalendarDate, getNextBillingDate, - isSentryPlan, lastTwoDigits, Plans, shouldDisplayTeamCard, @@ -40,9 +39,11 @@ function getPlans() { 'Unlimited public repositories', 'Unlimited private repositories', ], + isSentryPlan: false, + isTeamPlan: false, }, { - marketingName: 'Pro Team', + marketingName: 'Pro', value: Plans.USERS_PR_INAPPM, billingRate: BillingRate.MONTHLY, baseUnitPrice: 12, @@ -53,9 +54,11 @@ function getPlans() { 'Unlimited private repositories', 'Priorty Support', ], + isSentryPlan: false, + isTeamPlan: false, }, { - marketingName: 'Pro Team', + marketingName: 'Pro', value: Plans.USERS_PR_INAPPY, billingRate: BillingRate.ANNUALLY, baseUnitPrice: 10, @@ -66,9 +69,11 @@ function getPlans() { 'Unlimited private repositories', 'Priorty Support', ], + isSentryPlan: false, + isTeamPlan: false, }, { - marketingName: 'Pro Team', + marketingName: 'Enterprise', value: Plans.USERS_ENTERPRISEM, billingRate: BillingRate.MONTHLY, baseUnitPrice: 12, @@ -79,6 +84,8 @@ function getPlans() { 'Unlimited private repositories', 'Priorty Support', ], + isSentryPlan: false, + isTeamPlan: false, }, { marketingName: 'Pro Team', @@ -92,6 +99,8 @@ function getPlans() { 'Unlimited private repositories', 'Priorty Support', ], + isSentryPlan: false, + isTeamPlan: false, }, { marketingName: 'Sentry Pro Team', @@ -106,6 +115,8 @@ function getPlans() { 'Priority Support', ], trialTotalDays: 14, + isSentryPlan: true, + isTeamPlan: false, }, { marketingName: 'Sentry Pro Team', @@ -120,6 +131,8 @@ function getPlans() { 'Priority Support', ], trialTotalDays: 14, + isSentryPlan: true, + isTeamPlan: false, }, { marketingName: 'Team', @@ -134,6 +147,8 @@ function getPlans() { 'Patch coverage analysis', ], trialTotalDays: null, + isSentryPlan: false, + isTeamPlan: true, }, { marketingName: 'Team', @@ -148,6 +163,8 @@ function getPlans() { 'Patch coverage analysis', ], trialTotalDays: null, + isSentryPlan: false, + isTeamPlan: true, }, ] } @@ -172,6 +189,8 @@ describe('shouldDisplayTeamCard', () => { 'Unlimited private repositories', 'Priorty Support', ], + isSentryPlan: false, + isTeamPlan: false, }, { marketingName: 'Pro Team', @@ -185,6 +204,8 @@ describe('shouldDisplayTeamCard', () => { 'Unlimited private repositories', 'Priorty Support', ], + isSentryPlan: false, + isTeamPlan: false, }, ] expect(shouldDisplayTeamCard({ plans })).toBe(false) @@ -254,23 +275,6 @@ describe('getNextBillingDate', () => { }) }) -describe('isSentryPlan', () => { - it('supports monthly plan', () => { - expect(isSentryPlan('users-sentrym')).toBe(true) - expect(isSentryPlan(Plans.USERS_SENTRYM)).toBe(true) - }) - - it('supports annual plan', () => { - expect(isSentryPlan('users-sentryy')).toBe(true) - expect(isSentryPlan(Plans.USERS_SENTRYY)).toBe(true) - }) - - it('Defaults to false otherwise', () => { - expect(isSentryPlan('users-inappy')).toBe(false) - expect(isSentryPlan(undefined)).toBe(false) - }) -}) - describe('findSentryPlans', () => { it('contains monthly plan', () => { const plans = getPlans() @@ -289,6 +293,8 @@ describe('findSentryPlans', () => { 'Priority Support', ], trialTotalDays: 14, + isSentryPlan: true, + isTeamPlan: false, } expect(sentryPlanMonth).toStrictEqual(expectedResult) @@ -311,6 +317,8 @@ describe('findSentryPlans', () => { 'Priority Support', ], trialTotalDays: 14, + isSentryPlan: true, + isTeamPlan: false, } expect(sentryPlanYear).toStrictEqual(expectedResult) @@ -323,7 +331,7 @@ describe('findProPlans', () => { const { proPlanMonth } = findProPlans({ plans }) const expectedResult = { - marketingName: 'Pro Team', + marketingName: 'Pro', value: Plans.USERS_PR_INAPPM, billingRate: BillingRate.MONTHLY, baseUnitPrice: 12, @@ -334,6 +342,8 @@ describe('findProPlans', () => { 'Unlimited private repositories', 'Priorty Support', ], + isSentryPlan: false, + isTeamPlan: false, } expect(proPlanMonth).toStrictEqual(expectedResult) @@ -344,7 +354,7 @@ describe('findProPlans', () => { const { proPlanYear } = findProPlans({ plans }) const expectedResult = { - marketingName: 'Pro Team', + marketingName: 'Pro', value: Plans.USERS_PR_INAPPY, billingRate: BillingRate.ANNUALLY, baseUnitPrice: 10, @@ -355,6 +365,8 @@ describe('findProPlans', () => { 'Unlimited private repositories', 'Priorty Support', ], + isSentryPlan: false, + isTeamPlan: false, } expect(proPlanYear).toStrictEqual(expectedResult) @@ -379,6 +391,8 @@ describe('findTeamPlans', () => { 'Patch coverage analysis', ], trialTotalDays: null, + isSentryPlan: false, + isTeamPlan: true, } expect(teamPlanMonth).toStrictEqual(expectedResult) @@ -401,6 +415,8 @@ describe('findTeamPlans', () => { 'Patch coverage analysis', ], trialTotalDays: null, + isSentryPlan: false, + isTeamPlan: true, } expect(teamPlanYear).toStrictEqual(expectedResult) diff --git a/src/shared/utils/billing.ts b/src/shared/utils/billing.ts index 9af36c2435..f6b0140306 100644 --- a/src/shared/utils/billing.ts +++ b/src/shared/utils/billing.ts @@ -1,6 +1,5 @@ import { format, fromUnixTime } from 'date-fns' import isArray from 'lodash/isArray' -import isString from 'lodash/isString' import isUndefined from 'lodash/isUndefined' import { z } from 'zod' @@ -35,13 +34,6 @@ export const CollectionMethods = Object.freeze({ AUTOMATICALLY_CHARGED_METHOD: 'charge_automatically', }) -export function isSentryPlan(plan?: PlanName | null) { - if (isString(plan)) { - return plan === Plans.USERS_SENTRYM || plan === Plans.USERS_SENTRYY - } - return false -} - export const findProPlans = ({ plans, }: { diff --git a/src/shared/utils/upgradeForm.ts b/src/shared/utils/upgradeForm.ts index f70d3bf632..4c3dc1f920 100644 --- a/src/shared/utils/upgradeForm.ts +++ b/src/shared/utils/upgradeForm.ts @@ -14,7 +14,6 @@ import { findProPlans, findSentryPlans, findTeamPlans, - isSentryPlan, } from 'shared/utils/billing' export const MIN_NB_SEATS_PRO = 2 @@ -231,7 +230,7 @@ export const getDefaultValuesUpgradeForm = ({ const isPaidPlan = !!plan?.billingRate // If the plan has a billing rate, it's a paid plan let newPlan = proPlanYear - if (isSentryUpgrade && !isSentryPlan(plan?.value)) { + if (isSentryUpgrade && !plan?.isSentryPlan) { newPlan = isMonthlyPlan ? sentryPlanMonth : sentryPlanYear } else if (plan?.isTeamPlan || selectedPlan?.isTeamPlan) { newPlan = isMonthlyPlan ? teamPlanMonth : teamPlanYear From 031bea6e4da453ab2f53d579eeeedb4c3f9c9ced Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Mon, 23 Dec 2024 14:09:02 -0800 Subject: [PATCH 3/5] fix tests from isSentryPlan addition on usePlanData hook, and 1 or 2 trailing test fixes --- .../AccountSettings/AccountSettings.test.jsx | 1 + .../AccountSettingsSideMenu.test.jsx | 1 + .../DefaultOrgSelector.test.jsx | 1 + .../Activation/Activation.test.jsx | 1 + .../MembersActivation.test.jsx | 1 + .../MembersList/MembersList.test.jsx | 1 + .../MembersTable/MembersTable.test.jsx | 1 + .../ExceededUploadsAlert.test.jsx | 1 + .../HeaderBanners/HeaderBanners.test.jsx | 1 + .../ReachingUploadLimitAlert.test.jsx | 1 + .../Tabs/TrialReminder/TrialReminder.test.tsx | 1 + .../CancelPlanPage/CancelPlanPage.test.tsx | 1 + .../DowngradePlan/DowngradePlan.test.jsx | 1 + .../CurrentOrgPlan/CurrentOrgPlan.test.tsx | 1 + .../CurrentPlanCard/CurrentPlanCard.test.tsx | 5 +++ .../FreePlanCard/FreePlanCard.test.jsx | 2 ++ .../PlanUpgradeTeam/PlanUpgradeTeam.test.jsx | 3 ++ .../ProPlanSubheading.test.tsx | 3 +- .../PaidPlanCard/PaidPlanCard.test.tsx | 2 ++ .../ActionsBilling/ActionsBilling.test.jsx | 2 ++ .../ProPlanDetails/ProPlanDetails.test.jsx | 1 + .../SentryPlanDetails.test.jsx | 1 + .../TeamPlanDetails/TeamPlanDetails.test.jsx | 1 + .../UpgradeDetails/UpgradeDetails.test.tsx | 12 +++++++ .../Controllers/Controller.test.tsx | 12 +++++++ .../BillingOptions/BillingOptions.test.tsx | 1 + .../ProPlanController.test.tsx | 2 ++ .../BillingOptions/BillingOptions.test.tsx | 1 + .../SentryPlanController.test.tsx | 2 ++ .../BillingOptions/BillingOptions.test.tsx | 1 + .../ErrorBanner/ErrorBanner.test.tsx | 1 + .../TeamPlanController.test.tsx | 2 ++ .../PlanTypeOptions/PlanTypeOptions.test.tsx | 1 + .../UpdateBlurb/UpdateBlurb.test.tsx | 5 +++ .../UpdateButton/UpdateButton.test.tsx | 1 + .../UpgradeForm/UpgradeForm.test.tsx | 2 ++ .../UpgradePlanPage/UpgradePlanPage.test.jsx | 3 ++ .../ActivationAlert/ActivationAlert.test.tsx | 1 + .../ActivationBanner.test.tsx | 1 + src/services/account/usePlanData.test.tsx | 2 ++ .../ProPlanFeedbackBanner.test.tsx | 1 + .../TrialBanner/TrialBanner.test.tsx | 4 +++ src/shared/utils/billing.test.ts | 16 +++++++--- src/shared/utils/upgradeForm.test.ts | 31 ++++++++++++------- 44 files changed, 119 insertions(+), 17 deletions(-) diff --git a/src/pages/AccountSettings/AccountSettings.test.jsx b/src/pages/AccountSettings/AccountSettings.test.jsx index 3524ca9203..a6a4862d5a 100644 --- a/src/pages/AccountSettings/AccountSettings.test.jsx +++ b/src/pages/AccountSettings/AccountSettings.test.jsx @@ -168,6 +168,7 @@ describe('AccountSettings', () => { planValue === Plans.USERS_TEAMM || planValue === Plans.USERS_TEAMY, isTrialPlan: false, + isSentryPlan: false, }, }, }, diff --git a/src/pages/AccountSettings/AccountSettingsSideMenu.test.jsx b/src/pages/AccountSettings/AccountSettingsSideMenu.test.jsx index 9af63b5e82..835ec601cc 100644 --- a/src/pages/AccountSettings/AccountSettingsSideMenu.test.jsx +++ b/src/pages/AccountSettings/AccountSettingsSideMenu.test.jsx @@ -156,6 +156,7 @@ describe('AccountSettingsSideMenu', () => { planValue === Plans.USERS_TEAMM || planValue === Plans.USERS_TEAMY, isTrialPlan: false, + isSentryPlan: false, }, }, }, diff --git a/src/pages/DefaultOrgSelector/DefaultOrgSelector.test.jsx b/src/pages/DefaultOrgSelector/DefaultOrgSelector.test.jsx index 33b4c13735..bebdb375d2 100644 --- a/src/pages/DefaultOrgSelector/DefaultOrgSelector.test.jsx +++ b/src/pages/DefaultOrgSelector/DefaultOrgSelector.test.jsx @@ -220,6 +220,7 @@ describe('DefaultOrgSelector', () => { isTeamPlan: value === Plans.USERS_TEAMM || value === Plans.USERS_TEAMY, isTrialPlan: value === Plans.USERS_TRIAL, + isSentryPlan: false, trialStatus, value, }, diff --git a/src/pages/MembersPage/MembersActivation/Activation/Activation.test.jsx b/src/pages/MembersPage/MembersActivation/Activation/Activation.test.jsx index 4959230bc3..7e0d579042 100644 --- a/src/pages/MembersPage/MembersActivation/Activation/Activation.test.jsx +++ b/src/pages/MembersPage/MembersActivation/Activation/Activation.test.jsx @@ -29,6 +29,7 @@ const mockPlanData = { isEnterprisePlan: false, isFreePlan: true, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, baseUnitPrice: 10, diff --git a/src/pages/MembersPage/MembersActivation/MembersActivation.test.jsx b/src/pages/MembersPage/MembersActivation/MembersActivation.test.jsx index c9362331d3..e891792c42 100644 --- a/src/pages/MembersPage/MembersActivation/MembersActivation.test.jsx +++ b/src/pages/MembersPage/MembersActivation/MembersActivation.test.jsx @@ -43,6 +43,7 @@ const mockPlanData = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/MembersPage/MembersList/MembersList.test.jsx b/src/pages/MembersPage/MembersList/MembersList.test.jsx index f5097a9710..35e2ac192a 100644 --- a/src/pages/MembersPage/MembersList/MembersList.test.jsx +++ b/src/pages/MembersPage/MembersList/MembersList.test.jsx @@ -53,6 +53,7 @@ const mockActiveUserRequest = { const mockPlanData = { isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTrialPlan: false, baseUnitPrice: 10, benefits: [], diff --git a/src/pages/MembersPage/MembersList/MembersTable/MembersTable.test.jsx b/src/pages/MembersPage/MembersList/MembersTable/MembersTable.test.jsx index af1b1c372a..1220f3763f 100644 --- a/src/pages/MembersPage/MembersList/MembersTable/MembersTable.test.jsx +++ b/src/pages/MembersPage/MembersList/MembersTable/MembersTable.test.jsx @@ -92,6 +92,7 @@ const queryClient = new QueryClient({ const mockPlanData = { isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTrialPlan: false, baseUnitPrice: 10, benefits: [], diff --git a/src/pages/OwnerPage/HeaderBanners/ExceededUploadsAlert/ExceededUploadsAlert.test.jsx b/src/pages/OwnerPage/HeaderBanners/ExceededUploadsAlert/ExceededUploadsAlert.test.jsx index de3c13ba5f..f9f68ce43d 100644 --- a/src/pages/OwnerPage/HeaderBanners/ExceededUploadsAlert/ExceededUploadsAlert.test.jsx +++ b/src/pages/OwnerPage/HeaderBanners/ExceededUploadsAlert/ExceededUploadsAlert.test.jsx @@ -40,6 +40,7 @@ const mockPlanDataResponse = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/OwnerPage/HeaderBanners/HeaderBanners.test.jsx b/src/pages/OwnerPage/HeaderBanners/HeaderBanners.test.jsx index 69a02d692f..bfa97996c2 100644 --- a/src/pages/OwnerPage/HeaderBanners/HeaderBanners.test.jsx +++ b/src/pages/OwnerPage/HeaderBanners/HeaderBanners.test.jsx @@ -43,6 +43,7 @@ const mockPlanDataResponse = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/OwnerPage/HeaderBanners/ReachingUploadLimitAlert/ReachingUploadLimitAlert.test.jsx b/src/pages/OwnerPage/HeaderBanners/ReachingUploadLimitAlert/ReachingUploadLimitAlert.test.jsx index 782f204d98..28f4bae02d 100644 --- a/src/pages/OwnerPage/HeaderBanners/ReachingUploadLimitAlert/ReachingUploadLimitAlert.test.jsx +++ b/src/pages/OwnerPage/HeaderBanners/ReachingUploadLimitAlert/ReachingUploadLimitAlert.test.jsx @@ -33,6 +33,7 @@ const mockPlanDataResponse = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, trialStatus: TrialStatuses.NOT_STARTED, diff --git a/src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.test.tsx b/src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.test.tsx index 1eed682fad..9e28c4f1c3 100644 --- a/src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.test.tsx +++ b/src/pages/OwnerPage/Tabs/TrialReminder/TrialReminder.test.tsx @@ -40,6 +40,7 @@ const mockResponse = { planUserCount: 1, hasSeatsLeft: true, isEnterprisePlan: false, + isSentryPlan: false, isProPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/CancelPlanPage/CancelPlanPage.test.tsx b/src/pages/PlanPage/subRoutes/CancelPlanPage/CancelPlanPage.test.tsx index 0f76168a3d..4e5b15eefb 100644 --- a/src/pages/PlanPage/subRoutes/CancelPlanPage/CancelPlanPage.test.tsx +++ b/src/pages/PlanPage/subRoutes/CancelPlanPage/CancelPlanPage.test.tsx @@ -89,6 +89,7 @@ const mockPlanData = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/CancelPlanPage/subRoutes/DowngradePlan/DowngradePlan.test.jsx b/src/pages/PlanPage/subRoutes/CancelPlanPage/subRoutes/DowngradePlan/DowngradePlan.test.jsx index 82e66650d7..e9f679d6c6 100644 --- a/src/pages/PlanPage/subRoutes/CancelPlanPage/subRoutes/DowngradePlan/DowngradePlan.test.jsx +++ b/src/pages/PlanPage/subRoutes/CancelPlanPage/subRoutes/DowngradePlan/DowngradePlan.test.jsx @@ -32,6 +32,7 @@ const mockPlanData = { isEnterprisePlan: false, isFreePlan: true, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, baseUnitPrice: 10, diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx index 0d766d61af..5dd41c5c1a 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx @@ -53,6 +53,7 @@ const mockPlanDataResponse = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/CurrentPlanCard.test.tsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/CurrentPlanCard.test.tsx index 49c0477004..5a0b160500 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/CurrentPlanCard.test.tsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/CurrentPlanCard.test.tsx @@ -27,6 +27,7 @@ const proPlanDetails = { isEnterprisePlan: false, isFreePlan: false, isProPlan: true, + isSentryPlan: false, isTeamPlan: true, isTrialPlan: false, }, @@ -46,6 +47,7 @@ const freePlanDetails = { isEnterprisePlan: false, isFreePlan: true, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, }, @@ -65,6 +67,7 @@ const enterprisePlan = { isEnterprisePlan: true, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, }, @@ -84,6 +87,7 @@ const usesInvoiceTeamPlan = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: true, isTrialPlan: false, }, @@ -103,6 +107,7 @@ const trialPlanDetails = { isProPlan: false, isTeamPlan: true, isTrialPlan: true, + isSentryPlan: false, }, } diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.test.jsx index 208135af94..ef88f39867 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.test.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/FreePlanCard.test.jsx @@ -146,6 +146,7 @@ const freePlan = { isFreePlan: true, isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } @@ -172,6 +173,7 @@ const mockPlanData = { hasSeatsLeft: true, isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/PlanUpgradeTeam/PlanUpgradeTeam.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/PlanUpgradeTeam/PlanUpgradeTeam.test.jsx index 91e85a105e..9a03b25eb8 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/PlanUpgradeTeam/PlanUpgradeTeam.test.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/PlanUpgradeTeam/PlanUpgradeTeam.test.jsx @@ -16,6 +16,7 @@ const mockPlanBasic = { isEnterprisePlan: false, isFreePlan: true, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, baseUnitPrice: 0, @@ -37,6 +38,7 @@ const mockPlanPro = { isEnterprisePlan: false, isProPlan: true, isFreePlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, baseUnitPrice: 10, @@ -58,6 +60,7 @@ const mockPlanTrialing = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: true, baseUnitPrice: 10, diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/ProPlanSubheading/ProPlanSubheading.test.tsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/ProPlanSubheading/ProPlanSubheading.test.tsx index 6a58666b69..41cee28c0b 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/ProPlanSubheading/ProPlanSubheading.test.tsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/FreePlanCard/ProPlanSubheading/ProPlanSubheading.test.tsx @@ -24,8 +24,9 @@ const mockResponse = { planUserCount: 1, hasSeatsLeft: true, isEnterprisePlan: false, - isProPlan: false, isFreePlan: true, + isProPlan: false, + isSentryPlan: false, isTeamPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.test.tsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.test.tsx index 13f08614b5..ddd4ae15c4 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.test.tsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/PaidPlanCard/PaidPlanCard.test.tsx @@ -31,6 +31,7 @@ const mockProPlan = { isEnterprisePlan: false, isProPlan: true, isFreePlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, marketingName: 'Pro', @@ -52,6 +53,7 @@ const mockTeamPlan = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: true, isTrialPlan: false, marketingName: 'Team', diff --git a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx index 625312652c..5dbd067396 100644 --- a/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx +++ b/src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentPlanCard/shared/ActionsBilling/ActionsBilling.test.jsx @@ -178,6 +178,7 @@ const mockTrialData = { isEnterprisePlan: false, isFreePlan: true, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, }, @@ -249,6 +250,7 @@ describe('Actions Billing', () => { accountDetails.plan.value === Plans.USERS_TEAMM || accountDetails.plan.value === Plans.USERS_TEAMY, isTrialPlan: accountDetails.plan.value === Plans.USERS_TRIAL, + isSentryPlan: accountDetails.plan.value === Plans.USERS_SENTRYM, }, hasPrivateRepos, }, diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx index dfbf4ba9d0..125d56a8d6 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/ProPlanDetails/ProPlanDetails.test.jsx @@ -145,6 +145,7 @@ const mockPlanData = { hasSeatsLeft: true, isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx index 9ef3b00f8f..c0b2a57bb4 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/SentryPlanDetails/SentryPlanDetails.test.jsx @@ -142,6 +142,7 @@ const mockPlanData = { hasSeatsLeft: true, isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx index 57d3bfec96..33a2d0ab5a 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/TeamPlanDetails/TeamPlanDetails.test.jsx @@ -104,6 +104,7 @@ const mockPlanData = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.test.tsx index 90f54a95bd..060ff04df7 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeDetails/UpgradeDetails.test.tsx @@ -28,6 +28,8 @@ const proPlanYear = { 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, } const proPlanMonth = { @@ -42,6 +44,8 @@ const proPlanMonth = { 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, } const sentryPlanYear = { @@ -56,6 +60,8 @@ const sentryPlanYear = { 'Priority Support', ], monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: true, } const sentryPlanMonth = { @@ -70,6 +76,8 @@ const sentryPlanMonth = { 'Priority Support', ], monthlyUploadLimit: null, + isSentryPlan: true, + isTeamPlan: false, } const teamPlanYear = { @@ -79,6 +87,8 @@ const teamPlanYear = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, } const teamPlanMonth = { @@ -88,6 +98,8 @@ const teamPlanMonth = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, } type WrapperClosure = ( diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.test.tsx index 245e694f89..4eaa554bcb 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/Controller.test.tsx @@ -25,6 +25,8 @@ const proPlanMonth = { ], quantity: 10, monthlyUploadLimit: null, + isTeamPlan: false, + isSentryPlan: false, } const proPlanYear = { @@ -40,6 +42,8 @@ const proPlanYear = { ], monthlyUploadLimit: null, quantity: 13, + isTeamPlan: false, + isSentryPlan: false, } const sentryPlanMonth = { @@ -56,6 +60,8 @@ const sentryPlanMonth = { monthlyUploadLimit: null, trialDays: 14, quantity: 10, + isTeamPlan: false, + isSentryPlan: true, } const sentryPlanYear = { @@ -72,6 +78,8 @@ const sentryPlanYear = { monthlyUploadLimit: null, trialDays: 14, quantity: 21, + isTeamPlan: false, + isSentryPlan: true, } const teamPlanMonth = { @@ -81,6 +89,8 @@ const teamPlanMonth = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMM, + isTeamPlan: true, + isSentryPlan: false, } const teamPlanYear = { @@ -90,6 +100,8 @@ const teamPlanYear = { marketingName: 'Users Team', monthlyUploadLimit: 2500, value: Plans.USERS_TEAMY, + isTeamPlan: true, + isSentryPlan: false, } describe('Controller', () => { diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/ProPlanController/BillingOptions/BillingOptions.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/ProPlanController/BillingOptions/BillingOptions.test.tsx index 729d3aaa5c..9a21d7db69 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/ProPlanController/BillingOptions/BillingOptions.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/ProPlanController/BillingOptions/BillingOptions.test.tsx @@ -77,6 +77,7 @@ const mockPlanDataResponse = { isEnterprisePlan: false, isFreePlan: false, isProPlan: true, + isSentryPlan: false, isTeamPlan: true, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/ProPlanController/ProPlanController.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/ProPlanController/ProPlanController.test.tsx index 013bccdf98..ae71f3311b 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/ProPlanController/ProPlanController.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/ProPlanController/ProPlanController.test.tsx @@ -139,6 +139,7 @@ const mockPlanDataResponseMonthly = { isEnterprisePlan: false, isProPlan: true, isFreePlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } @@ -160,6 +161,7 @@ const mockPlanDataResponseYearly = { isEnterprisePlan: false, isProPlan: true, isFreePlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/SentryPlanController/BillingOptions/BillingOptions.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/SentryPlanController/BillingOptions/BillingOptions.test.tsx index 686d8f3c57..5ba0230fe9 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/SentryPlanController/BillingOptions/BillingOptions.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/SentryPlanController/BillingOptions/BillingOptions.test.tsx @@ -77,6 +77,7 @@ const mockPlanDataResponse = { isEnterprisePlan: false, isFreePlan: false, isProPlan: true, + isSentryPlan: true, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/SentryPlanController/SentryPlanController.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/SentryPlanController/SentryPlanController.test.tsx index b3d504135a..00f42c3ae5 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/SentryPlanController/SentryPlanController.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/SentryPlanController/SentryPlanController.test.tsx @@ -124,6 +124,7 @@ const mockPlanDataResponseMonthly = { isEnterprisePlan: false, isFreePlan: false, isProPlan: true, + isSentryPlan: true, isTeamPlan: false, isTrialPlan: false, } @@ -145,6 +146,7 @@ const mockPlanDataResponseYearly = { isEnterprisePlan: false, isFreePlan: false, isProPlan: true, + isSentryPlan: true, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/BillingOptions/BillingOptions.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/BillingOptions/BillingOptions.test.tsx index cd67fd64b5..39fc4dba94 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/BillingOptions/BillingOptions.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/BillingOptions/BillingOptions.test.tsx @@ -67,6 +67,7 @@ const mockPlanDataResponse = { hasSeatsLeft: true, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: true, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/ErrorBanner/ErrorBanner.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/ErrorBanner/ErrorBanner.test.tsx index 63fb988665..4f09379889 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/ErrorBanner/ErrorBanner.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/ErrorBanner/ErrorBanner.test.tsx @@ -143,6 +143,7 @@ describe('ErrorBanner', () => { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/TeamPlanController.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/TeamPlanController.test.tsx index bd5fc71e07..0cdb271017 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/TeamPlanController.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/Controllers/TeamPlanController/TeamPlanController.test.tsx @@ -124,6 +124,7 @@ const mockPlanDataResponseMonthly = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } @@ -145,6 +146,7 @@ const mockPlanDataResponseYearly = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.test.tsx index 19d7f9bab8..83999c4760 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/PlanTypeOptions/PlanTypeOptions.test.tsx @@ -206,6 +206,7 @@ describe('PlanTypeOptions', () => { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.test.tsx index 9a89818d50..a954607627 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateBlurb/UpdateBlurb.test.tsx @@ -16,6 +16,7 @@ const planChunk = { planUserCount: 2, isEnterprisePlan: false, isFreePlan: false, + isSentryPlan: false, isTeamPlan: true, isTrialPlan: false, hasSeatsLeft: true, @@ -35,6 +36,7 @@ const proPlanYear = { monthlyUploadLimit: null, isProPlan: true, isTeamPlan: false, + isSentryPlan: false, } const teamPlanYear = { @@ -46,6 +48,7 @@ const teamPlanYear = { value: Plans.USERS_TEAMY, isProPlan: false, isTeamPlan: true, + isSentryPlan: false, } const teamPlanMonth = { @@ -57,6 +60,7 @@ const teamPlanMonth = { value: Plans.USERS_TEAMM, isProPlan: false, isTeamPlan: true, + isSentryPlan: false, } const freePlan = { @@ -68,6 +72,7 @@ const freePlan = { value: Plans.USERS_BASIC, isProPlan: false, isTeamPlan: false, + isSentryPlan: false, } type WrapperClosure = ( diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx index c8d52e889c..785bbf59dd 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpdateButton/UpdateButton.test.tsx @@ -145,6 +145,7 @@ describe('UpdateButton', () => { pretrialUsersCount: 0, isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTrialPlan: false, } if (planValue.value === Plans.USERS_BASIC) { diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx index 371afe8079..4a7ad77ffd 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradeForm/UpgradeForm.test.tsx @@ -222,6 +222,7 @@ const mockPlanDataResponse = { planUserCount: 10, hasSeatsLeft: true, isEnterprisePlan: false, + isSentryPlan: false, } const queryClient = new QueryClient({ @@ -372,6 +373,7 @@ describe('UpgradeForm', () => { planValue === Plans.USERS_PR_INAPPY || planValue === Plans.USERS_SENTRYM || planValue === Plans.USERS_SENTRYY, + isSentryPlan: false, isTeamPlan: planValue === Plans.USERS_TEAMM || planValue === Plans.USERS_TEAMY, diff --git a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx index 77b5382393..24ac959b52 100644 --- a/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx +++ b/src/pages/PlanPage/subRoutes/UpgradePlanPage/UpgradePlanPage.test.jsx @@ -234,6 +234,9 @@ describe('UpgradePlanPage', () => { isFreePlan: planValue === Plans.USERS_BASIC, isProPlan: planValue === Plans.USERS_PR_INAPPY, isTrialPlan: planValue === Plans.USERS_TRIAL, + isSentryPlan: + planValue === Plans.USERS_SENTRYY || + planValue === Plans.USERS_SENTRYM, value: planValue, }, }, diff --git a/src/pages/RepoPage/ActivationAlert/ActivationAlert.test.tsx b/src/pages/RepoPage/ActivationAlert/ActivationAlert.test.tsx index 126107396b..cc4bb987ae 100644 --- a/src/pages/RepoPage/ActivationAlert/ActivationAlert.test.tsx +++ b/src/pages/RepoPage/ActivationAlert/ActivationAlert.test.tsx @@ -65,6 +65,7 @@ const mockTrialData = { hasSeatsLeft: true, isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTrialPlan: false, } diff --git a/src/pages/RepoPage/CoverageOnboarding/ActivationBanner/ActivationBanner.test.tsx b/src/pages/RepoPage/CoverageOnboarding/ActivationBanner/ActivationBanner.test.tsx index f0a02b14f2..2804f891de 100644 --- a/src/pages/RepoPage/CoverageOnboarding/ActivationBanner/ActivationBanner.test.tsx +++ b/src/pages/RepoPage/CoverageOnboarding/ActivationBanner/ActivationBanner.test.tsx @@ -65,6 +65,7 @@ const mockTrialData = { hasSeatsLeft: true, isEnterprisePlan: false, isProPlan: false, + isSentryPlan: false, isTrialPlan: false, } diff --git a/src/services/account/usePlanData.test.tsx b/src/services/account/usePlanData.test.tsx index be8dbc00d6..17f00434ef 100644 --- a/src/services/account/usePlanData.test.tsx +++ b/src/services/account/usePlanData.test.tsx @@ -26,6 +26,7 @@ const mockTrialData = { isEnterprisePlan: false, isFreePlan: true, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, }, @@ -95,6 +96,7 @@ describe('usePlanData', () => { isEnterprisePlan: false, isFreePlan: true, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, marketingName: 'Users Basic', diff --git a/src/shared/GlobalTopBanners/ProPlanFeedbackBanner/ProPlanFeedbackBanner.test.tsx b/src/shared/GlobalTopBanners/ProPlanFeedbackBanner/ProPlanFeedbackBanner.test.tsx index e576ff5061..bf9688a923 100644 --- a/src/shared/GlobalTopBanners/ProPlanFeedbackBanner/ProPlanFeedbackBanner.test.tsx +++ b/src/shared/GlobalTopBanners/ProPlanFeedbackBanner/ProPlanFeedbackBanner.test.tsx @@ -17,6 +17,7 @@ const mockTrialData = { isEnterprisePlan: false, isFreePlan: false, isProPlan: true, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, baseUnitPrice: 10, diff --git a/src/shared/GlobalTopBanners/TrialBanner/TrialBanner.test.tsx b/src/shared/GlobalTopBanners/TrialBanner/TrialBanner.test.tsx index 188fa8e7cd..d49088fc89 100644 --- a/src/shared/GlobalTopBanners/TrialBanner/TrialBanner.test.tsx +++ b/src/shared/GlobalTopBanners/TrialBanner/TrialBanner.test.tsx @@ -33,6 +33,7 @@ const proPlanMonth = { isEnterprisePlan: false, isFreePlan: false, isProPlan: true, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } @@ -55,6 +56,7 @@ const trialPlan = { isEnterprisePlan: false, isFreePlan: false, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: true, } @@ -76,6 +78,7 @@ const basicPlan = { planUserCount: 1, isFreePlan: true, isProPlan: false, + isSentryPlan: false, isTeamPlan: false, isTrialPlan: false, } @@ -169,6 +172,7 @@ describe('TrialBanner', () => { isProPlan: plan.isProPlan, isTeamPlan: plan.isTeamPlan, isTrialPlan: plan.isTrialPlan, + isSentryPlan: plan.isSentryPlan, }, }, }, diff --git a/src/shared/utils/billing.test.ts b/src/shared/utils/billing.test.ts index 8f5ef40879..975f7a6271 100644 --- a/src/shared/utils/billing.test.ts +++ b/src/shared/utils/billing.test.ts @@ -427,7 +427,9 @@ describe('canApplySentryUpgrade', () => { it('returns true when list contains monthly plan', () => { const result = canApplySentryUpgrade({ isEnterprisePlan: false, - plans: [{ value: Plans.USERS_SENTRYM }] as IndividualPlan[], + plans: [ + { value: Plans.USERS_SENTRYM, isSentryPlan: true }, + ] as IndividualPlan[], }) expect(result).toBeTruthy() @@ -436,7 +438,9 @@ describe('canApplySentryUpgrade', () => { it('returns true when list contains annual plan', () => { const result = canApplySentryUpgrade({ isEnterprisePlan: false, - plans: [{ value: Plans.USERS_SENTRYY }] as IndividualPlan[], + plans: [ + { value: Plans.USERS_SENTRYY, isSentryPlan: true }, + ] as IndividualPlan[], }) expect(result).toBeTruthy() @@ -444,7 +448,9 @@ describe('canApplySentryUpgrade', () => { it('returns false when plans are not in list', () => { const result = canApplySentryUpgrade({ - plans: [{ value: Plans.USERS_FREE }] as IndividualPlan[], + plans: [ + { value: Plans.USERS_FREE, isSentryPlan: false }, + ] as IndividualPlan[], }) expect(result).toBeFalsy() @@ -453,7 +459,9 @@ describe('canApplySentryUpgrade', () => { it('returns false when user has enterprise plan', () => { const result = canApplySentryUpgrade({ isEnterprisePlan: true, - plans: [{ value: Plans.USERS_SENTRYY }] as IndividualPlan[], + plans: [ + { value: Plans.USERS_SENTRYY, isSentryPlan: true }, + ] as IndividualPlan[], }) expect(result).toBeFalsy() diff --git a/src/shared/utils/upgradeForm.test.ts b/src/shared/utils/upgradeForm.test.ts index a451f3c944..10572099d5 100644 --- a/src/shared/utils/upgradeForm.test.ts +++ b/src/shared/utils/upgradeForm.test.ts @@ -175,6 +175,7 @@ describe('getDefaultValuesUpgradeForm', () => { value: Plans.USERS_SENTRYY, planUserCount: 1, isTeamPlan: false, + isSentryPlan: true, } as Plan, }) @@ -184,6 +185,7 @@ describe('getDefaultValuesUpgradeForm', () => { value: Plans.USERS_SENTRYY, planUserCount: 1, isTeamPlan: false, + isSentryPlan: true, }, seats: 5, }) @@ -311,6 +313,8 @@ describe('getSchema', () => { accountDetails, selectedPlan: { value: Plans.USERS_TEAMY, + isTeamPlan: true, + isTrialPlan: false, } as Plan, }) @@ -375,24 +379,24 @@ describe('extractSeats', () => { describe('user on free plan and can upgrade to sentry plan', () => { it('returns min seats when members are less than min', () => { const seats = extractSeats({ - value: Plans.USERS_BASIC, quantity: 1, isSentryUpgrade: true, activatedUserCount: 0, inactiveUserCount: 0, isFreePlan: true, + isTrialPlan: false, }) expect(seats).toEqual(5) }) it('returns members number as seats when members are greater than min', () => { const seats = extractSeats({ - value: Plans.USERS_BASIC, quantity: 1, isSentryUpgrade: true, activatedUserCount: 10, inactiveUserCount: 2, isFreePlan: true, + isTrialPlan: false, }) expect(seats).toEqual(12) }) @@ -401,24 +405,24 @@ describe('extractSeats', () => { describe('user on free plan and can not upgrade to sentry plan', () => { it('returns min seats when members are less than min', () => { const seats = extractSeats({ - value: Plans.USERS_BASIC, quantity: 1, isSentryUpgrade: false, activatedUserCount: 0, inactiveUserCount: 0, isFreePlan: true, + isTrialPlan: false, }) expect(seats).toEqual(2) }) it('returns members number as seats when members are greater than min', () => { const seats = extractSeats({ - value: Plans.USERS_BASIC, quantity: 1, activatedUserCount: 10, inactiveUserCount: 2, isSentryUpgrade: false, isFreePlan: true, + isTrialPlan: false, }) expect(seats).toEqual(12) }) @@ -427,11 +431,12 @@ describe('extractSeats', () => { describe('user on paid plan', () => { it('returns members number as seats', () => { const seats = extractSeats({ - value: Plans.USERS_PR_INAPPM, quantity: 8, activatedUserCount: 12, inactiveUserCount: 0, isSentryUpgrade: false, + isFreePlan: false, + isTrialPlan: false, }) expect(seats).toEqual(8) }) @@ -440,12 +445,12 @@ describe('extractSeats', () => { describe('user on sentry plan', () => { it('returns members number as seats', () => { const seats = extractSeats({ - value: Plans.USERS_SENTRYM, quantity: 8, activatedUserCount: 12, inactiveUserCount: 0, isSentryUpgrade: false, isFreePlan: false, + isTrialPlan: false, }) expect(seats).toEqual(8) }) @@ -454,22 +459,22 @@ describe('extractSeats', () => { describe('user on paid plan and can upgrade to sentry plan', () => { it('returns members number as seats if greater than min', () => { const seats = extractSeats({ - value: Plans.USERS_PR_INAPPM, quantity: 8, activatedUserCount: 12, inactiveUserCount: 0, isSentryUpgrade: true, isFreePlan: false, + isTrialPlan: false, }) expect(seats).toEqual(8) }) it('returns min seats if less than min', () => { const seats = extractSeats({ - value: Plans.USERS_PR_INAPPM, quantity: 2, isSentryUpgrade: true, isFreePlan: false, + isTrialPlan: false, }) expect(seats).toEqual(5) }) @@ -479,13 +484,13 @@ describe('extractSeats', () => { describe('user has access to sentry upgrade', () => { it('returns sentry plan base seat count as seats', () => { const seats = extractSeats({ - value: Plans.USERS_TRIAL, quantity: 8, activatedUserCount: 12, inactiveUserCount: 0, isSentryUpgrade: true, trialStatus: TrialStatuses.ONGOING, isFreePlan: false, + isTrialPlan: true, }) expect(seats).toEqual(5) @@ -495,13 +500,13 @@ describe('extractSeats', () => { describe('user does not have access to sentry upgrade', () => { it('returns pro plan base seat count as seats', () => { const seats = extractSeats({ - value: Plans.USERS_TRIAL, quantity: 8, activatedUserCount: 12, inactiveUserCount: 0, isSentryUpgrade: false, trialStatus: TrialStatuses.ONGOING, isFreePlan: false, + isTrialPlan: true, }) expect(seats).toEqual(2) @@ -515,7 +520,7 @@ describe('shouldRenderCancelLink', () => { // eslint-disable-next-line testing-library/render-result-naming-convention const value = shouldRenderCancelLink({ cancelAtPeriodEnd: false, - plan: { value: Plans.USERS_PR_INAPPY, isFreePlan: false } as Plan, + plan: { isFreePlan: false, isTrialPlan: false } as Plan, trialStatus: TrialStatuses.NOT_STARTED, }) @@ -527,7 +532,7 @@ describe('shouldRenderCancelLink', () => { // eslint-disable-next-line testing-library/render-result-naming-convention const cancelLinkResult = shouldRenderCancelLink({ cancelAtPeriodEnd: false, - plan: { value: Plans.USERS_BASIC, isFreePlan: true } as Plan, + plan: { isFreePlan: true, isTrialPlan: false } as Plan, trialStatus: TrialStatuses.NOT_STARTED, }) @@ -577,6 +582,8 @@ describe('shouldRenderCancelLink', () => { billingRate: BillingRate.ANNUALLY, value: Plans.USERS_TEAMY, planUserCount: 1, + isTeamPlan: true, + isSentryPlan: false, } as Plan, }) From fbb20d59be200cd1a0a64b7bd627a71c893c9598 Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Mon, 23 Dec 2024 14:38:47 -0800 Subject: [PATCH 4/5] forgot to add these to the query lol. good thing we tested --- src/services/account/useAvailablePlans.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/services/account/useAvailablePlans.ts b/src/services/account/useAvailablePlans.ts index 709882d08a..d1b041bab2 100644 --- a/src/services/account/useAvailablePlans.ts +++ b/src/services/account/useAvailablePlans.ts @@ -37,6 +37,8 @@ const query = ` marketingName monthlyUploadLimit value + isTeamPlan + isSentryPlan } } } From 07ce6b038e841e175b2d91112219cc5b0367f0af Mon Sep 17 00:00:00 2001 From: Ajay Singh Date: Mon, 23 Dec 2024 14:39:20 -0800 Subject: [PATCH 5/5] alphabetize them --- src/services/account/useAvailablePlans.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/account/useAvailablePlans.ts b/src/services/account/useAvailablePlans.ts index d1b041bab2..ad3389c290 100644 --- a/src/services/account/useAvailablePlans.ts +++ b/src/services/account/useAvailablePlans.ts @@ -34,11 +34,11 @@ const query = ` baseUnitPrice benefits billingRate + isSentryPlan + isTeamPlan marketingName monthlyUploadLimit value - isTeamPlan - isSentryPlan } } }