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

Add unit test to components #122

Open
rosudhi opened this issue May 4, 2021 · 4 comments
Open

Add unit test to components #122

rosudhi opened this issue May 4, 2021 · 4 comments
Labels
enhancement New feature or request react-components-lab react components lab package

Comments

@rosudhi
Copy link
Contributor

rosudhi commented May 4, 2021

I think this is the right time to add unit test to the components since they are small in number for now. If we add later when numbers are grow, we may overwhelmed.
Unit test is needed to make sure our component more robust, and bug less.

@rosudhi rosudhi added enhancement New feature or request react-components-lab react components lab package labels May 4, 2021
@bertearazvan
Copy link
Contributor

Jest would be a good library I believe for achieving this.

I think that for bigger components we should also do some integration testing and not only unit - just an idea.

@rosudhi
Copy link
Contributor Author

rosudhi commented May 6, 2021

Yeap, i think we can use Jest and React testing-library for do unit testing and integration testing or maybe functional testing. We may need enzyme to do end-to-end testing, thought.

Also i agreed with @rihr that we may want to have a testing on react-component package instead of lab, but it would be nice if we have an automated testing in our lab, just for basic one such as snapshot testing ? it would be useful to prevent the existing component UI changed unexpectedly, then we can have more advanced testing in react-component package.

Also i see mui has this testing on their lab package, this is something that maybe we can implement.
image

What do you think @rihr @bertearazvan ?

@rihr
Copy link
Contributor

rihr commented May 6, 2021

Not a bad idea, I don't mind adding in the tests, but I don't think we should add any more barriers to adding components in the lab - otherwise this will discourage some of us from sharing at all.
They should remain fully optional in the lab until they are to be moved up.

@bertearazvan
Copy link
Contributor

They should remain fully optional in the lab until they are to be moved up.

agree

Yeap, i think we can use Jest and React testing-library for do unit testing and integration testing or maybe functional testing. We may need enzyme to do end-to-end testing, thought.

don't see the need of end-to-end testing since we are not testing apps

Also i agreed with @rihr that we may want to have a testing on react-component package instead of lab, but it would be nice if we have an automated testing in our lab, just for basic one such as snapshot testing ? it would be useful to prevent the existing component UI changed unexpectedly, then we can have more advanced testing in react-component package.

Yeah I think so, however we don't mainly depend on the testing pipeline to check if a component has changed or not, but rather also test it in the storybook. I would suggest sticking to basic unit testing for core and those snapshots (unsure how valuable they actually are)

Also i see mui has this testing on their lab package, this is something that maybe we can implement.

Sounds like a good idea to add those, if anything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request react-components-lab react components lab package
Projects
None yet
Development

No branches or pull requests

3 participants