You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -93,9 +93,11 @@ I also went to lengths to try to ensure I did not infringe upon Nintendo's intel
93
93
#### Trunks of treevolutions
94
94
95
95
Evolutions display correctly for both fully linear evolutions *and* 2-long branches of treevolutions.
96
-
Treevolutions display a random path that can be randomly changed with a button. 3-long branches are static, meaning that they are always wrong for Pokémon like, for example, Dustox.
96
+
Treevolutions and 3-long branches display a random path that can be randomly changed with a button. A warning is also displayed for these.
97
97
I might eventually implement a proper tree view. If I were to do this, I would probably do it in a modal, and replace the normal line view with a button to open that modal.
98
98
99
+
One solution for 3-long branches could be to also work backwards from the current ID, instead of always working forward from the earliest evolution in the chain.
100
+
99
101
#### Automated unit testing
100
102
101
103
I did not do the bonus objective that called for unit-testing the application. Time constraints being what they were, I decided to triage this, since I know the company does not generally use automated unit testing in its UI (instead relying on a mixture of manual QA and end-to-end testing). I did, however, ensure that [Jest](https://jestjs.io) was at least present and ready to go (by integrating `vite-template-redux` into the project).
// If we've matched the ID before or now, then we can choose the next node at random, if there are more than one of them.
65
-
if(idFound){
66
-
if(link.evolves_to.length>1){//WARN: The below is only a rough approximation of tree evolutions; please use `EvolutionTree` instead of `EvolutionLine` to properly display evolution trees.
67
-
constindex=Math.floor(Math.random()*link.evolves_to.length);// Choosing a random index to at least get some variety.
68
-
nextInLine=link.evolves_to[index]!;
64
+
// If even the current ID wasn't a match, try looking deeper
//BUG: If the match is one level deeper, this won't find it, and we'll end-up going with the `0` index...
77
+
// If we have no next-in-line at this point, then we can choose the next node at random.
78
+
if(!nextInLine){
79
+
if(link.evolves_to.length>1){//WARN: This is only a rough approximation of tree evolutions; please use `EvolutionTree` instead of `EvolutionLine` to properly display evolution trees.
80
+
constindex=Math.floor(Math.random()*link.evolves_to.length);// Choosing a random index to at least get some variety.
0 commit comments