Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Convert to TS - shared context, plan, propTypes, treePaths #3438

Merged
merged 6 commits into from
Oct 28, 2024

Conversation

suejung-sentry
Copy link
Contributor

@suejung-sentry suejung-sentry commented Oct 24, 2024

Convert a group of files from JS --> TS
codecov/engineering-team#2745

@codecov-notifications
Copy link

codecov-notifications bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3438      +/-   ##
==========================================
- Coverage   99.15%   99.15%   -0.01%     
==========================================
  Files         806      806              
  Lines       14259    14257       -2     
  Branches     3946     3939       -7     
==========================================
- Hits        14139    14137       -2     
  Misses        111      111              
  Partials        9        9              
Files with missing lines Coverage Δ
src/services/repo/useRepoOverview.tsx 96.66% <100.00%> (ø)
src/shared/context/activeContext.ts 100.00% <ø> (ø)
src/shared/plan/BenefitList/BenefitList.tsx 100.00% <100.00%> (ø)
...plan/ScheduledPlanDetails/ScheduledPlanDetails.tsx 100.00% <100.00%> (ø)
src/shared/propTypes/commitRequestType.ts 100.00% <ø> (ø)
src/shared/propTypes/dataMarketingType.ts 100.00% <100.00%> (ø)
src/shared/treePaths/useCommitTreePath.ts 100.00% <100.00%> (ø)
src/shared/treePaths/useTreePaths.ts 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 100.00% <ø> (ø)
Pages 98.89% <ø> (ø)
Services 99.45% <100.00%> (ø)
Shared 99.80% <100.00%> (-0.01%) ⬇️
UI 99.12% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55c16c2...e9aaefa. Read the comment docs.

Copy link

codecov-public-qa bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.15%. Comparing base (55c16c2) to head (e9aaefa).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3438      +/-   ##
==========================================
- Coverage   99.15%   99.15%   -0.01%     
==========================================
  Files         806      806              
  Lines       14259    14257       -2     
  Branches     3946     3946              
==========================================
- Hits        14139    14137       -2     
  Misses        111      111              
  Partials        9        9              
Files Coverage Δ
src/services/repo/useRepoOverview.tsx 96.66% <100.00%> (ø)
src/shared/context/activeContext.ts 100.00% <ø> (ø)
src/shared/plan/BenefitList/BenefitList.tsx 100.00% <100.00%> (ø)
...plan/ScheduledPlanDetails/ScheduledPlanDetails.tsx 100.00% <100.00%> (ø)
src/shared/propTypes/commitRequestType.ts 100.00% <ø> (ø)
src/shared/propTypes/dataMarketingType.ts 100.00% <100.00%> (ø)
src/shared/treePaths/useCommitTreePath.ts 100.00% <100.00%> (ø)
src/shared/treePaths/useTreePaths.ts 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 100.00% <ø> (ø)
Pages 98.89% <ø> (ø)
Services 99.45% <100.00%> (ø)
Shared 99.80% <100.00%> (-0.01%) ⬇️
UI 99.12% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55c16c2...e9aaefa. Read the comment docs.

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.15%. Comparing base (82b3d3e) to head (bac9611).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3438   +/-   ##
=======================================
  Coverage   99.15%   99.15%           
=======================================
  Files         808      806    -2     
  Lines       14269    14257   -12     
  Branches     3942     3946    +4     
=======================================
- Hits        14148    14137   -11     
+ Misses        112      111    -1     
  Partials        9        9           
Files with missing lines Coverage Δ
src/services/repo/useRepoOverview.tsx 96.66% <100.00%> (ø)
src/shared/context/activeContext.ts 100.00% <ø> (ø)
src/shared/plan/BenefitList/BenefitList.tsx 100.00% <100.00%> (ø)
...plan/ScheduledPlanDetails/ScheduledPlanDetails.tsx 100.00% <100.00%> (ø)
src/shared/propTypes/commitRequestType.ts 100.00% <ø> (ø)
src/shared/propTypes/dataMarketingType.ts 100.00% <100.00%> (ø)
src/shared/treePaths/useCommitTreePath.ts 100.00% <100.00%> (ø)
src/shared/treePaths/useTreePaths.ts 100.00% <100.00%> (ø)

... and 5 files with indirect coverage changes

Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 100.00% <ø> (ø)
Pages 98.89% <ø> (ø)
Services 99.45% <100.00%> (ø)
Shared 99.80% <100.00%> (+<0.01%) ⬆️
UI 99.12% <ø> (+0.06%) ⬆️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 82b3d3e...bac9611. Read the comment docs.

@codecov-qa
Copy link

codecov-qa bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.15%. Comparing base (55c16c2) to head (e9aaefa).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3438      +/-   ##
==========================================
- Coverage   99.15%   99.15%   -0.01%     
==========================================
  Files         806      806              
  Lines       14259    14257       -2     
  Branches     3939     3939              
==========================================
- Hits        14139    14137       -2     
  Misses        111      111              
  Partials        9        9              
Files with missing lines Coverage Δ
src/services/repo/useRepoOverview.tsx 96.66% <100.00%> (ø)
src/shared/context/activeContext.ts 100.00% <ø> (ø)
src/shared/plan/BenefitList/BenefitList.tsx 100.00% <100.00%> (ø)
...plan/ScheduledPlanDetails/ScheduledPlanDetails.tsx 100.00% <100.00%> (ø)
src/shared/propTypes/commitRequestType.ts 100.00% <ø> (ø)
src/shared/propTypes/dataMarketingType.ts 100.00% <100.00%> (ø)
src/shared/treePaths/useCommitTreePath.ts 100.00% <100.00%> (ø)
src/shared/treePaths/useTreePaths.ts 100.00% <100.00%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 100.00% <ø> (ø)
Pages 98.89% <ø> (ø)
Services 99.45% <100.00%> (ø)
Shared 99.80% <100.00%> (-0.01%) ⬇️
UI 99.12% <ø> (ø)

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 55c16c2...e9aaefa. Read the comment docs.

Copy link

codecov bot commented Oct 25, 2024

Bundle Report

Changes will decrease total bundle size by 443 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.5MB 400 bytes (-0.01%) ⬇️
gazebo-production-system-esm 5.55MB 43 bytes (-0.0%) ⬇️

@suejung-sentry suejung-sentry marked this pull request as ready for review October 25, 2024 23:03
@codecov-releaser
Copy link
Contributor

codecov-releaser commented Oct 25, 2024

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
3fd89d4 Fri, 25 Oct 2024 23:07:02 GMT Expired Expired
bac9611 Mon, 28 Oct 2024 19:26:58 GMT Expired Expired
e9aaefa Mon, 28 Oct 2024 19:34:55 GMT Cloud Enterprise

@@ -8,7 +8,7 @@ const queryClient = new QueryClient({
defaultOptions: { queries: { retry: false } },
})

const wrapper = ({ children }) => (
const wrapper = ({ children }: { children: React.ReactNode }) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: We usually type this guy out as wrapper: React.FC<React.PropsWithChildren>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah thanks! I followed the wrong pattern - fixed it in other files I saw using the wrong way, too, so others don't mistake that too!


export function getScheduleStart(scheduledPhase) {
export function getScheduleStart(scheduledPhase: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thoughts on turning this into a shared interface for these two functions?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I like that - fixed!

import { MemoryRouter, Route } from 'react-router-dom'

import { useCommitTreePaths } from './useCommitTreePath'

describe('useCommitTreePaths', () => {
describe('a path is provided', () => {
describe('no duplicate names in path', () => {
const wrapper = ({ children }) => (
const wrapper = ({ children }: { children: ReactNode }) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment for these as above

function setup({
repoOverviewData,
}: {
repoOverviewData: typeof overviewMock
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this would actually be the type of the zod schema right?

const RepositorySchema = z.object({

Also if the mock isn't changing, could modify line 81 to just use the mock directly and remove the need to pass it in outright

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah great catch - I meant to come back to fix that one - sloppy. Fixed!

There's one spot passing its own data instead of that general overviewMock so left the current way and fixed the type

repo,
owner,
},
{ suspense: false }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this removed on purpose?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, useRepoOverview doesn't take that argument (and can't find where it ever did?) So removing this would be a no-op

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Nice fix :)

@codecov-staging
Copy link

codecov-staging bot commented Oct 28, 2024

Bundle Report

Changes will decrease total bundle size by 471 bytes (-0.0%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-staging-system-esm* 5.55MB 71 bytes (-0.0%) ⬇️
gazebo-staging-system 5.5MB 400 bytes (-0.01%) ⬇️

ℹ️ *Bundle size includes cached data from a previous commit

@@ -18,7 +22,7 @@ const queryClient = new QueryClient({

const wrapper =
(initialEntries = '/gh/owner/coolrepo/tree/main/src%2Ftests') =>
({ children }) => (
({ children }: { children: ReactNode }) => (
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left this one as I thought this notation was a bit clearer

Copy link
Contributor

@ajay-sentry ajay-sentry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@suejung-sentry suejung-sentry added this pull request to the merge queue Oct 28, 2024
Merged via the queue into main with commit ad73902 Oct 28, 2024
54 checks passed
@suejung-sentry suejung-sentry deleted the sshin/fix/2745 branch October 28, 2024 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants