-
Notifications
You must be signed in to change notification settings - Fork 753
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
Tests: Improve the Code Coverage initiative using Jest #480
base: main
Are you sure you want to change the base?
Conversation
Hey @timothymarois, This is a much needed update for the Flowbite Library to make it sustainable in the future. I'll be here to assist whenever needed - took a look at the code, it looks good to me! I suppose these tests will later be integrated with CI as well when creating PRs. Cheers, PS: let me know when the basis of this update has been made since I could muster the community from Flowbite to help us out with some unit tests, though we'll need to write a contribution guide for these tests so we make sure everyone is onboard with the same approach. |
Hi @timothymarois, I would love to help to this pull request, do you have anything i can pickup? |
@zoltanszogyenyi Yep, that's the idea; if we can get enough coverage, then we can integrate CI/Actions and have automated tests run on every PR submitted. @CorwinDev Right now, I just set up the basics, but if you want to start testing the more complex items such as data attributes, etc. We can mimic the modal test I provided for the other components. |
Hey @timothymarois @CorwinDev, I think it's best if we take each component step by step and start with the easier stuff. And we should create a "checkbox" tasks template for each component unit test, for example:
For reference the Flowbite React has some pretty good tests going on and we could use that as inspiration:
Stuff like So my suggestion is to finish up the Modal component as a benchmark and then go onto the other components. We can also take some inspiration from Bootstrap's unit tests as they also use data attributes and are battle tested for over 15 years now: https://github.com/twbs/bootstrap/tree/main/js/tests. Here are their unit tests for the Modal component: https://github.com/twbs/bootstrap/blob/main/js/tests/unit/modal.spec.js. This is probably our golden standard if you will. |
npm run test
using Jest, ts-jest, jest-environment-jsdom