Skip to content

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

Open

Description

@jordan-simonovski

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions