Skip to content

Commit

Permalink
refactor(types): remove type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
micah-yeager committed Nov 15, 2024
1 parent d22d5dc commit 7c72ae3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
21 changes: 12 additions & 9 deletions app/components/Card/Card.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ afterEach(cleanup)
test.each([
{ testName: "default", children: "content" },
{ testName: "section", children: "content", as: "main" },
] as FCCase<typeof Card>[])("$testName Card", ({ testName, ...props }) => {
render(<Card {...props} data-testid={testName} />)
] as const satisfies FCCase<typeof Card>[])(
"$testName Card",
({ testName, ...props }) => {
render(<Card {...props} data-testid={testName} />)

screen.getByTestId(testName)
screen.getByText(props.children)
if (props.as) {
// Not perfect to equate `as` to `role`, but it's good enough for this test.
screen.getByRole(props.as)
}
})
screen.getByTestId(testName)
screen.getByText(props.children)
if (props.as) {
// Not perfect to equate `as` to `role`, but it's good enough for this test.
screen.getByRole(props.as)
}
},
)

test.each([
{ testName: "empty", to: "#" },
Expand Down
2 changes: 1 addition & 1 deletion app/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function loader() {
return json({
ENV: {
TURNSTILE_SITE_KEY,
} as Env,
} satisfies Env,
})
}

Expand Down

0 comments on commit 7c72ae3

Please sign in to comment.