Realizar test asíncronos puede mejorar la calidad de tu aplicación ['ESP','ENG']

avatar

Buenas a todos esta vez quiero compartir con la comunidad cómo realizar test de programación en funciones asíncronas este tipo de test son muy efectivos en el caso que uno quiera probar si una función que llama a una cierta api está funcionando correctamente Y si la api también sigue activa de manera que uno no tiene que estar probando desde el lado de desarrollo o producción sencillamente este test verifica que la llamada siempre esté funcionando correctamente.

Hello everyone, this time I want to share with the community how to perform programming tests on asynchronous functions. This type of test is very effective in the event that one wants to test if a function that calls a certain API is working correctly and if the API also continues. active so that one does not have to be testing from the development or production side, this test simply verifies that the call is always working correctly.

asinco.jpg
Como se verá en el test la función está definida aparte el único que retorna es una data en caso contrario ratón de error pero en el test a la hora de comprobar si existe alguna respuesta del api espera que se adapta sea definida y después pregunta si la data o el dato tiene una longitud mayor a cierta cantidad por otro lado lo que hace es setear un error para obligar a que funcione correctamente el manejo de errores.

As will be seen in the test, the function is defined separately, the only thing that returns is a data, otherwise there is an error mouse, but in the test, when checking if there is any response from the api, it waits for the api to be defined and then asks if the data or the data has a length greater than a certain amount, on the other hand what it does is set an error to force the error handling to work correctly.
![asinco1.jpg]()

asinco2.jpg



0
0
0.000
1 comments
avatar

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. 
 

0
0
0.000