Realizar Test sencillos en react, es necesario para mejorar a largo plazo ['ESP','ENG']

in StemSocial17 days ago

React siempre ha sido una librería poderosa en lo que respecta al desarrollo web, pero algo que deje de lado por mucho tiempo fueron los test, por razones personales para dedicarle tiempo a otros aprendizajes y ahora que le he dedicado un par de horas a entender cómo se realizan, realmente me doy cuenta que son necesarios y sencillos de aplicar.
Por el momento son simples test unitarios para verificar que todo funcione bien dentro de cada componente u la existencia de dichos elementos antes de cada carga de la web.

React has always been a powerful library when it comes to web development, but something that I left aside for a long time were the tests, for personal reasons to dedicate time to other learning and now that I have dedicated a couple of hours to understanding how are done, I really realize that they are necessary and easy to apply. At the moment they are simple unit tests to verify that everything works well within each component and the existence of said elements before each website load.
![test11.jpg]() En esta muestra solo se aplican a la existencia de dicho elemento y que ocurre si se ejecuta un evento dentro de la etiqueta. Se puede apreciar que hay dos test, uno para la aplicación en general y otro para un componente aparte, lo genial es que los test se ejecutan todos a la vez y no por bloque de código resultando más práctico para detectar posibles errores. El test que muestro detecta si existe una etiqueta “input” y si ejecuta un evento dentro de la etiqueta “button”.
In this sample they only apply to the existence of said element and what happens if an event is executed within the tag. You can see that there are two tests, one for the application in general and another for a separate component. The great thing is that the tests are executed all at the same time and not per block of code, making it more practical to detect possible errors. The test I show detects if an “input” tag exists and if it executes an event within the “button” tag.

test12.jpg

test13.jpg
La teoría dice que los test no deben ser sobre cualquier cosa, sino sobre casos específicos u cualquier otro evento en el cual se espere un resultado especifico.

The theory says that tests should not be about anything, but about specific cases or any other event in which a specific result is expected.
Sort:  

Thanks for your contribution to the STEMsocial community. Feel free to join us on discord to get to know the rest of us!

Please consider delegating to the @stemsocial account (85% of the curation rewards are returned).

You may also include @stemsocial as a beneficiary of the rewards of this post to get a stronger support. 
 

Congratulations @dobro2020! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You got more than 1750 replies.
Your next target is to reach 2000 replies.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out our last posts:

LEO Power Up Day - May 15, 2024