The code in the attached zip file provides an algorithm that checks the availabilities of an agenda depending of the events attached to it. The main method has a start date for input and is looking for the availabilities of the next 7 days.
They are two kinds of events:
opening, are the openings for a specific day and they can be recurring week by week.appointment, times when the doctor is already booked.
Unfortunately, the code is broken. Here is your mission:
- Fix the tests.
- Optimize and refactor if needed.
- Allow the function to return availabilities on as many days as requested (10 for instance):
// The function you turn in MUST use this signature. Otherwise it won’t pass
// our tests.
function getAvailabilities(date, numberOfDays = 7) {}Please create a commit after each step. Feel free to refactor or add unit tests at any moment.
Run the turnin.sh (turnin.ps1 if you are on Windows) script which will
build the turnin.git.zip archive you should send us back. Be aware that any
uncommited change won’t be part of the archive!