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: useAllPokemon hook #25

Open
3 tasks
Tracked by #15
henrylin03 opened this issue Dec 15, 2024 · 0 comments
Open
3 tasks
Tracked by #15

test: useAllPokemon hook #25

henrylin03 opened this issue Dec 15, 2024 · 0 comments

Comments

@henrylin03
Copy link
Owner

custom hook was introduced in #17 to fetch pokemon data from PokeAPI (using useEffect()) and returning all Pokemon data, whether it is loading, and any errors.

test should be written to mock the API call and ensure core functionalities of the hook, namely:

  • correct data (structure) is returned
  • loading state is set correctly (incl if any image hasn't been loaded, it is still in loading state, if even 1 pokemon hasn't been fully loaded yet (even if every other one has) it is still in loading state)
  • error state set correctly (although this isn't really being managed by the app yet - to be done in feat: add error on loading screen if there is an error encountered when fetching pokemons #16 so can do it with that ticket)
henrylin03 added a commit that referenced this issue Dec 16, 2024
…our. part of #15.

#25 will test the hook, which has some issues that need to be resolved. #26 will implement e2e testing. #10 is tested here, along with ensuring the helper functions do not return any ids that are duplicates (that would be bad for gameplay).
henrylin03 added a commit that referenced this issue Dec 16, 2024
…our. docs: update README. chore: move CSS modules into folders with components.

having tests and CSS modules in the same folder as the components increases ease of maintainability. this ticket fixes #15, although the subtasks will be completed separately: #25 will test the hook, which has some issues that need to be resolved. #26 will implement e2e testing. #10 is tested here, along with ensuring the helper function to randomly select Pokemon IDs do not return any ids that are duplicates (that would be bad for gameplay). README was updated to increase size of the logo, update the screenshot to have hover effect apparent, and added more explanation around using Vitest and RTL. Removed acknowledgement for an old loading image (Pokeball) as we are now just using the Masterball that Muhammad Jazman created.
henrylin03 added a commit that referenced this issue Dec 16, 2024
…our. docs: update README. chore: move CSS modules into folders with components.

having tests and CSS modules in the same folder as the components increases ease of maintainability. this ticket fixes #15, although the subtasks will be completed separately: #25 will test the hook, which has some issues that need to be resolved. #26 will implement e2e testing. #10 is tested here, along with ensuring the helper function to randomly select Pokemon IDs do not return any ids that are duplicates (that would be bad for gameplay). README was updated to increase size of the logo, update the screenshot to have hover effect apparent, and added more explanation around using Vitest and RTL. Removed acknowledgement for an old loading image (Pokeball) as we are now just using the Masterball that Muhammad Jazman created.
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

No branches or pull requests

1 participant