bmi-calculator icon indicating copy to clipboard operation
bmi-calculator copied to clipboard

Add tests

Open GermaVinsmoke opened this issue 4 years ago • 5 comments

Add tests to test App.jsx and Bar.jsx

GermaVinsmoke avatar Oct 28 '19 14:10 GermaVinsmoke

I can help with that

Larissagilliane avatar Oct 30 '19 16:10 Larissagilliane

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 avatar Oct 30 '19 16:10 GermaVinsmoke

@GermaVinsmoke can i open a new issue to refactor the folder organization ?

Larissagilliane avatar Oct 30 '19 16:10 Larissagilliane

Yeah

GermaVinsmoke avatar Oct 30 '19 17:10 GermaVinsmoke

@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.

Larissagilliane avatar Nov 03 '19 21:11 Larissagilliane