6 kyu
PC upgrade specs using HOC in ReactJS
510richkotze
Loading description...
React
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Brilliant kata to get someone started with HOC's.
It might be useful to write a test against hard coding 110 straight into the HOC instead of reading the value from the second parameter passed to withPriceModel.
I enjoyed the atmosphere from the Code Dojo as well. Make sure you ping me again when you organise the next one ;)
I think there should be a test spying on
withPriceModel
execution count. Some of the solutions I see here are creating new component on every render.I think I might have cheated as well. Maybe we should call withPriceModel ourselves in the test with diferent price increaments
I think you have solved the kata correctly, even using
withProps
from recompose.The only thing here is you have not learned to build your own HOC as recompose does that for you.
The point of this kata is to help with getting started building your own HOC.
That is good feedback, perhaps have a couple tests for the fake models to see if
withPriceModel
can handle different price increases.@richkotze Could you fix the sample test to change that the Pro model should increase by 60 not 50. Cheers.
Now fixed.
The default solution throws the following error:
Error: kata.js: Unexpected token (23:20)
. Could you modify the default setup to compile?Fixed this. Added in tests to give better feedback for initial test run.
Needs random tests.
I've added in random generated values for some props expected to be passed through.
These failed tests are mystifying me. The four tests each in "Display the basic model pc" and "Display the pro model pc" all pass (and so does "withPriceModel returns a function"), but the others all fail (all had returned undefined except the last one which had returned "p"). :/
What I will do is put descriptions in the assert of what is expected and this might help.
I've updated the assert descriptions, let me know if that helps you.
Otherwise it might be best to show some code and I will try help.