itaditya / trick-or-treat-game

Play it for free here
https://trick-or-treat.netlify.com/
16 stars 17 forks source link

Write tests for ScoreBoard #56

Closed itaditya closed 4 years ago

itaditya commented 4 years ago

Currently the user flow

Showing list of scores (fetched from localStorage) on game page

is not tested. Using jest and @testing-library/react tests have to be added for this flow.

Tests should go in src/tests/ScoreBoard.test.js

devTeaa commented 4 years ago

I'll work on this one

devTeaa commented 4 years ago

@itaditya you mind if I move the code to read local storage from ScoreBoard.js to Game.js so that the ScoreBoard component received an array of the values?

itaditya commented 4 years ago

The Game.js component has alread gotten pretty big and it is not the responsibility of Game.js to deal with ScoreBoard data. So yeah please keep the logic in ScoreBoard.js only.

If you got stuck in mocking localStorage or something let me know