Replace `as any` mock fixtures in three app test files with shoehorn
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 9.9k
- Forks
- 471
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 117
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
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.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, testing
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100