✨: LIB-538 Refactor + add Dafalgan support #40
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Notes
wiki.md
file in the project to keep the documentation in the same place than my project. But I would recommend using Github's wiki feature if possible. I didn't use it here to avoid creating a second project.node
in production (and notts-node
!)Drug.benefit
because the exercises specifies that the public API should not be changed and I wanted to add the check for benefit value (setBenefit
method as it is more explicit to me but it was not possible here. I'd love to hear what you think about that setter.Process
babel
withtypescript
straight away so I could use it for my tests (although the tests should have been the second thing to do after documentation to ensure no regressions).Drug
class as to me, theDrug
(model) must be aware of its own logic, not thePharmacy
(controller).Drug
based on a name. If theDrug
class is not abstract, it is possible to create anew Drug('Fervex', 30, 20)
that will behave as aDrug
instance despite the name'Fervex'
passed to the constructor. The developper should use theFervex
class so its instance has the overridden method ofupdateValues()
corresponding to Fervex's logic.Dafalgan
rules.Dafalgan
support.I did not add the Dafalgan to the
index.ts
as it is not required by the instructions and it would modify theoutput.txt
.Time Management
In total, I spent around 4 hours on the tests:
Many Thanks! 🎉
If you're reading this, it means you took time to review my PR properly so... Thanks a lot!
I never had a refactoring project as a technical test, I think it's a great idea and this one was fun to tackle.
I would be really glad to hear your feedbacks regarding my work, whether it's a full review here or a call.
I would also love to know how you would have done it, if you have any advice regarding anything (code, patterns, tests, tools, git practices...), I am always eager to further improve.