-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test for userform component #49
Conversation
Los tests pasan pero saltan unas warnings que creo que tienen que ver con esto: reactwg/react-18#102 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolver las warnings. Creo que wrapeando las llamadas asíncronas en act() debería andar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Los test deberian ir en un describe para poder agruparlos de manera legible.
User event se recomienda usar con setup() por react-testing-library:
https://testing-library.com/docs/user-event/intro/
eso es problema de react y jest que se pasan la pelota y no lo arreglan se lo mostre al santi y me dijo que todo bien |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eliminar console.log
El sendPlayerName puede fallar, deberia estar dentro de el try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En los mocks si el ok es true el status deberia ser 200
400 en duplacte entry y 422 en default
En el test shouldn't register hay un try con catch vacio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cambiar la llamada a sendPlayer adentro del try-catch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Test de userForm funcionando testea el caso de que el usuario pueda unirse y el de que no, mockeando la funcion de request
Test de createGameForm funcionando testea el caso de que el usuario pueda unirse y el de que no catcheando errores, mockeando la funcion de request y navigate para evitar renderear otros componentes y de esta manera lograr que el test sea unitario