Member-only story
How to test your JavaScript components
3 min readSep 17, 2018
Testing is not always as easy as we want but is really necessary when we write software but is almost equal necessary to understand which parts have to test and how to structure our code.
The first, and most important error when we write Fronted code is to have everything inside the components, let’s see how I recommend structuring things in the projects.
As you can see we have three types of logic:
- View Logic
- Component Logic
- Data Logic (Data related to the Business logic of the application/api/backend)
The problems of this kind of structure (everything inside the component, to have…