Thanks for taking the time to download this refactoring exercise.
This solution contains three classes used by an imaginary bicycle distributor to produce order receipts and some unit tests to prove that everything works.
Pretend this code is part of a more extensive software system and you are given responsibility for it.
Refactor the code so that it can handle:
- More bikes at new prices
- Different discount codes and percentages
Refactor the code so that it can survive an onslaught of the upcoming changes, you're confident it works, and you're comfortable the next engineer will quickly understand how to work on it.
Be pragmatic in your refactoring. Don't use something fancy if you feel it's not needed.
Zip up your project (remove node_modules) and submit it with your resume at this job posting: https://trainerroad.recruiterbox.com/jobs/fk0j1wf. Don't do a PR/Fork as everyone else would see your work and could copy it.
If we love your refactoring and your resume is legit, we'll move to the next step. This might seem like a lot of hoops to jump through, but it's way better than hiring someone who answers trivia questions in an interview well but can't code worth a damn.
You will need node and npm or yarn installed and setup on your machine. Once ready run the following from the root directory of the project.
yarn
or
npm install
After installing the packages you can run either of the following to run the tests
yarn test
or
npm test