Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
suejung-sentry committed Jan 30, 2025
1 parent 36dbab4 commit c9f5c17
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/pages/PlanPage/PlanPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import config from 'config'

import { SentryRoute } from 'sentry'

import { useUnverifiedPaymentMethods } from 'services/account/useUnverifiedPaymentMethods'
import { Provider } from 'shared/api/helpers'
import { Theme, useThemeContext } from 'shared/ThemeContext'
import A from 'ui/A'
Expand All @@ -19,7 +20,6 @@ import PlanBreadcrumb from './PlanBreadcrumb'
import { PlanPageDataQueryOpts } from './queries/PlanPageDataQueryOpts'
import Tabs from './Tabs'

import { useUnverifiedPaymentMethods } from 'services/account/useUnverifiedPaymentMethods'
import { StripeAppearance } from '../../stripe'

const CancelPlanPage = lazy(() => import('./subRoutes/CancelPlanPage'))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { MemoryRouter, Route } from 'react-router-dom'
import { z } from 'zod'

import { PlanUpdatedPlanNotificationContext } from 'pages/PlanPage/context'
import { AccountDetailsSchema, TrialStatuses } from 'services/account'
import { BillingRate, Plans } from 'shared/utils/billing'
import { AccountDetailsSchema } from 'services/account'
import { Plans } from 'shared/utils/billing'
import { AlertOptions, type AlertOptionsType } from 'ui/Alert'

import CurrentOrgPlan from './CurrentOrgPlan'
Expand All @@ -36,28 +36,6 @@ const mockNoEnterpriseAccount = {
},
}

const mockPlanDataResponse = {
baseUnitPrice: 10,
benefits: [],
billingRate: BillingRate.MONTHLY,
marketingName: 'some-name',
monthlyUploadLimit: 123,
value: Plans.USERS_PR_INAPPM,
trialStatus: TrialStatuses.NOT_STARTED,
trialStartDate: '',
trialEndDate: '',
trialTotalDays: 0,
pretrialUsersCount: 0,
planUserCount: 1,
hasSeatsLeft: true,
isEnterprisePlan: false,
isFreePlan: false,
isProPlan: false,
isSentryPlan: false,
isTeamPlan: false,
isTrialPlan: false,
}

const mockEnterpriseAccountDetailsNinetyPercent = {
owner: {
account: {
Expand Down Expand Up @@ -170,10 +148,15 @@ describe('CurrentOrgPlan', () => {
graphql.query('EnterpriseAccountDetails', () => {
return HttpResponse.json({ data: enterpriseAccountDetails })
}),
graphql.query('GetPlanData', () => {
graphql.query('CurrentOrgPlanPageData', () => {
return HttpResponse.json({
data: {
owner: { hasPrivateRepos: true, plan: { ...mockPlanDataResponse } },
owner: {
plan: { value: Plans.USERS_PR_INAPPM },
billing: {
unverifiedPaymentMethods: [],
},
},
},
})
}),
Expand Down
2 changes: 1 addition & 1 deletion src/services/account/useCurrentOrgPlanPageData.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ afterAll(() => server.close())
describe('useCurrentOrgPlanPageData', () => {
function setup(mockData = {}) {
server.use(
graphql.query('GetCurrentOrgPlanPageData', () => {
graphql.query('CurrentOrgPlanPageData', () => {
return HttpResponse.json({ data: mockData })
})
)
Expand Down
10 changes: 5 additions & 5 deletions src/services/account/useCurrentOrgPlanPageData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const UnverifiedPaymentMethodSchema = z.object({
hostedVerificationUrl: z.string(),
})

export const CurrentOrgPlanPageDataSchema = z
const CurrentOrgPlanPageDataSchema = z
.object({
owner: z
.object({
Expand All @@ -28,16 +28,16 @@ export const CurrentOrgPlanPageDataSchema = z
})
.nullish()

export interface UseCurrentOrgPlanPageDataArgs {
interface UseCurrentOrgPlanPageDataArgs {
provider: string
owner: string
opts?: {
enabled?: boolean
}
}

export const query = `
query GetCurrentOrgPlanPageData($owner: String!) {
const query = `
query CurrentOrgPlanPageData($owner: String!) {
owner(username: $owner) {
plan {
value
Expand All @@ -58,7 +58,7 @@ export const useCurrentOrgPlanPageData = ({
opts,
}: UseCurrentOrgPlanPageDataArgs) =>
useQuery({
queryKey: ['GetCurrentOrgPlanPageData', provider, owner, query],
queryKey: ['CurrentOrgPlanPageData', provider, owner, query],
queryFn: ({ signal }) =>
Api.graphql({
provider,
Expand Down

0 comments on commit c9f5c17

Please sign in to comment.