bmi-calculator
bmi-calculator copied to clipboard
Add tests
Add tests to test App.jsx and Bar.jsx
I can help with that
Thanks for helping with this issue. I think it'll also teach me a lot about the testing environment as I am a beginner in this. 😅
@GermaVinsmoke can i open a new issue to refactor the folder organization ?
Yeah
@GermaVinsmoke i think you need to do some changes in your code to turn easier to test your components. For example you can avoid magic numbers using constants, like in if (len > 7) newVal = newVal.slice(1, len);
instead using those number directly you should use constants in another file and calling them.
It's a good practice to use const
instead of let
when the value that you're using will not change, it is safer guarantee that his value is a constant.
Another point is that you're calculating a lot of bussiness logic inside 'handleChange', it's not wrong, but you could do that in another function for example.
You can open new PR's if you want, or just ignore all these considetations.