Skip to content

Commit c9f5c17

Browse files
cleanup
1 parent 36dbab4 commit c9f5c17

File tree

4 files changed

+16
-33
lines changed

4 files changed

+16
-33
lines changed

src/pages/PlanPage/PlanPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import config from 'config'
88

99
import { SentryRoute } from 'sentry'
1010

11+
import { useUnverifiedPaymentMethods } from 'services/account/useUnverifiedPaymentMethods'
1112
import { Provider } from 'shared/api/helpers'
1213
import { Theme, useThemeContext } from 'shared/ThemeContext'
1314
import A from 'ui/A'
@@ -19,7 +20,6 @@ import PlanBreadcrumb from './PlanBreadcrumb'
1920
import { PlanPageDataQueryOpts } from './queries/PlanPageDataQueryOpts'
2021
import Tabs from './Tabs'
2122

22-
import { useUnverifiedPaymentMethods } from 'services/account/useUnverifiedPaymentMethods'
2323
import { StripeAppearance } from '../../stripe'
2424

2525
const CancelPlanPage = lazy(() => import('./subRoutes/CancelPlanPage'))

src/pages/PlanPage/subRoutes/CurrentOrgPlan/CurrentOrgPlan.test.tsx

+9-26
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import { MemoryRouter, Route } from 'react-router-dom'
1212
import { z } from 'zod'
1313

1414
import { PlanUpdatedPlanNotificationContext } from 'pages/PlanPage/context'
15-
import { AccountDetailsSchema, TrialStatuses } from 'services/account'
16-
import { BillingRate, Plans } from 'shared/utils/billing'
15+
import { AccountDetailsSchema } from 'services/account'
16+
import { Plans } from 'shared/utils/billing'
1717
import { AlertOptions, type AlertOptionsType } from 'ui/Alert'
1818

1919
import CurrentOrgPlan from './CurrentOrgPlan'
@@ -36,28 +36,6 @@ const mockNoEnterpriseAccount = {
3636
},
3737
}
3838

39-
const mockPlanDataResponse = {
40-
baseUnitPrice: 10,
41-
benefits: [],
42-
billingRate: BillingRate.MONTHLY,
43-
marketingName: 'some-name',
44-
monthlyUploadLimit: 123,
45-
value: Plans.USERS_PR_INAPPM,
46-
trialStatus: TrialStatuses.NOT_STARTED,
47-
trialStartDate: '',
48-
trialEndDate: '',
49-
trialTotalDays: 0,
50-
pretrialUsersCount: 0,
51-
planUserCount: 1,
52-
hasSeatsLeft: true,
53-
isEnterprisePlan: false,
54-
isFreePlan: false,
55-
isProPlan: false,
56-
isSentryPlan: false,
57-
isTeamPlan: false,
58-
isTrialPlan: false,
59-
}
60-
6139
const mockEnterpriseAccountDetailsNinetyPercent = {
6240
owner: {
6341
account: {
@@ -170,10 +148,15 @@ describe('CurrentOrgPlan', () => {
170148
graphql.query('EnterpriseAccountDetails', () => {
171149
return HttpResponse.json({ data: enterpriseAccountDetails })
172150
}),
173-
graphql.query('GetPlanData', () => {
151+
graphql.query('CurrentOrgPlanPageData', () => {
174152
return HttpResponse.json({
175153
data: {
176-
owner: { hasPrivateRepos: true, plan: { ...mockPlanDataResponse } },
154+
owner: {
155+
plan: { value: Plans.USERS_PR_INAPPM },
156+
billing: {
157+
unverifiedPaymentMethods: [],
158+
},
159+
},
177160
},
178161
})
179162
}),

src/services/account/useCurrentOrgPlanPageData.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ afterAll(() => server.close())
2727
describe('useCurrentOrgPlanPageData', () => {
2828
function setup(mockData = {}) {
2929
server.use(
30-
graphql.query('GetCurrentOrgPlanPageData', () => {
30+
graphql.query('CurrentOrgPlanPageData', () => {
3131
return HttpResponse.json({ data: mockData })
3232
})
3333
)

src/services/account/useCurrentOrgPlanPageData.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const UnverifiedPaymentMethodSchema = z.object({
1313
hostedVerificationUrl: z.string(),
1414
})
1515

16-
export const CurrentOrgPlanPageDataSchema = z
16+
const CurrentOrgPlanPageDataSchema = z
1717
.object({
1818
owner: z
1919
.object({
@@ -28,16 +28,16 @@ export const CurrentOrgPlanPageDataSchema = z
2828
})
2929
.nullish()
3030

31-
export interface UseCurrentOrgPlanPageDataArgs {
31+
interface UseCurrentOrgPlanPageDataArgs {
3232
provider: string
3333
owner: string
3434
opts?: {
3535
enabled?: boolean
3636
}
3737
}
3838

39-
export const query = `
40-
query GetCurrentOrgPlanPageData($owner: String!) {
39+
const query = `
40+
query CurrentOrgPlanPageData($owner: String!) {
4141
owner(username: $owner) {
4242
plan {
4343
value
@@ -58,7 +58,7 @@ export const useCurrentOrgPlanPageData = ({
5858
opts,
5959
}: UseCurrentOrgPlanPageDataArgs) =>
6060
useQuery({
61-
queryKey: ['GetCurrentOrgPlanPageData', provider, owner, query],
61+
queryKey: ['CurrentOrgPlanPageData', provider, owner, query],
6262
queryFn: ({ signal }) =>
6363
Api.graphql({
6464
provider,

0 commit comments

Comments
 (0)