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

Help wanted: split type & runtime tests for openapi-fetch #1852

Closed
drwpow opened this issue Aug 14, 2024 · 0 comments · Fixed by #1895
Closed

Help wanted: split type & runtime tests for openapi-fetch #1852

drwpow opened this issue Aug 14, 2024 · 0 comments · Fixed by #1895
Labels
enhancement New feature or request good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project openapi-fetch Relevant to the openapi-fetch library PRs welcome PRs are welcome to solve this issue!

Comments

@drwpow
Copy link
Contributor

drwpow commented Aug 14, 2024

For openapi-fetch, most of our tests live in a single index.test.ts file. Instead, we should separate them into at least 2:

  • runtime.test.ts: tests the runtime, such as: Did the correct headers get sent? Did query params serialize correctly? Did the JSON get parsed correctly? Is FormData handled? etc
  • types.test-d.ts: basically the bulk of tests: Are we showing required params correctly? Optional params? Are we handling data/error correctly? What about all the options?

The *.test-d.ts file uses Vitest type checking and should make more use of expectTypeOf() and other helpers to make more granular assertions. This would help make triaging bugs like #1845, #1798, and #1525 easier.

@drwpow drwpow added enhancement New feature or request openapi-fetch Relevant to the openapi-fetch library PRs welcome PRs are welcome to solve this issue! good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project labels Aug 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Straightforward problem, solvable for first-time contributors without deep knowledge of the project openapi-fetch Relevant to the openapi-fetch library PRs welcome PRs are welcome to solve this issue!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant