Replace `as any` mock fixtures in three app test files with shoehorn

Open Beginner friendly
#2,852 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
88/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
react, typescript
Domain
frontend, testing

Research direction

Open the three named test files and locate each partial mock using } as any and its eslint suppression. Replace the seven assertions with fromPartial({...}) from @total-typescript/shoehorn, then run yarn ratchet:update and verify the app/as-any and app/eslint-disable baselines decrease as described.

Written by the indexing model from the issue text.

Description

good first issue

Three test files added in #2802, #2816 and #2817 build partial mock objects with } as any and an // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion above each:

file hatches
packages/app/src/components/__tests__/MetricTableModelForm.test.tsx 4
packages/app/src/components/__tests__/DBTimeChart.test.tsx 2
packages/app/src/components/__tests__/DBRowSidePanel.viewTraceTimeFilter.test.tsx 1

These are the case @total-typescript/shoehorn is for: fromPartial({...}) gives the same brevity while still type-checking the fields you do set, so a renamed or retyped field breaks the test instead of sailing through the assertion.

Swapping them lets the ratchet baseline in scripts/ci/ratchet-baseline.json come back down (app/as-any 215 → 208, app/eslint-disable 143 → 136) via yarn ratchet:update.

Noticed while re-baselining the ratchet in #2661.

Dominant language
TypeScript
Stars
9.9k
Forks
471
Avg merge
2d 4h
Merged PRs (30d)
117

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hyperdxio/hyperdx

All issues in hyperdxio/hyperdx

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.