KyleJune / deno-tailwind-ui-react-example

An example of how you can use Tailwind UI and React with Deno
20 stars 5 forks source link

Add test coverage with React Testing Library #8

Open KyleJune opened 2 years ago

KyleJune commented 2 years ago

https://testing-library.com/docs/react-testing-library/intro/

KyleJune commented 2 years ago

It appears this currently doesn't work when importing testing-library from esm.sh.

https://github.com/alephjs/esm.sh/issues/248

KyleJune commented 2 years ago

I have a branch locally where I started working on this, the branch is named test.

For this, I believe I should be using StaticRouter since the tests are not running in the browser. Below is a guide for testing react-router. The example uses v5, I added a link below highlighting the differences between v5 and v6.

https://testing-library.com/docs/example-react-router/ https://reactrouter.com/docs/en/v6/upgrading/v5

Below is a guide for testing react-query.

https://react-query.tanstack.com/guides/testing