Skip to content
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

Merged
merged 11 commits into from
Oct 20, 2023
Merged

test for userform component #49

merged 11 commits into from
Oct 20, 2023

Conversation

milicarabelos
Copy link
Collaborator

@milicarabelos milicarabelos commented Oct 15, 2023

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

@klartz
Copy link
Collaborator

klartz commented Oct 15, 2023

Los tests pasan pero saltan unas warnings que creo que tienen que ver con esto: reactwg/react-18#102

image

Copy link
Collaborator

@klartz klartz left a 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

Copy link
Collaborator

@TomasBazan TomasBazan left a 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/

@milicarabelos
Copy link
Collaborator Author

Los tests pasan pero saltan unas warnings que creo que tienen que ver con esto: reactwg/react-18#102

image

eso es problema de react y jest que se pasan la pelota y no lo arreglan
testing-library/react-testing-library#1061

se lo mostre al santi y me dijo que todo bien

Copy link
Collaborator

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

Copy link
Collaborator

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

Copy link
Collaborator

@TomasBazan TomasBazan left a 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

Copy link
Collaborator

@TomasBazan TomasBazan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@milicarabelos milicarabelos merged commit a62ef87 into main Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants