Member-only story

How to test your JavaScript components

Quique Fdez. Guerra
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.

How some people structure the components

As you can see we have three types of logic:

  • View Logic
Example of logic inside the view layer
  • Component Logic
Example of logic inside the component layer, related to the component
  • Data Logic (Data related to the Business logic of the application/api/backend)
Example of logic inside the component layer, related to the data

The problems of this kind of structure (everything inside the component, to have…

--

--

Quique Fdez. Guerra
Quique Fdez. Guerra

Written by Quique Fdez. Guerra

Director of Engineering at @PlainConcepts Romania Frontend Developer Lazy @Github contributor Happy @Helpdev_ founder Web @GoogleDevExpert

No responses yet