5. Refactor for testability: business hours
MediumDebugging & productionDebugging
isOpen decides whether support is open (Monday–Friday, 09:00 until 17:00). It reads the system clock, so its tests are flaky: they pass or fail depending on when they run.
Refactor it to take the day of the week (0 = Sunday … 6 = Saturday) and the hour (0–23) as parameters: isOpen(day, hour). Production code can pass the current time in.
Example 1
Input: isOpen(5, 17) Output: false
Constraints
Fix the bug; keep the function signature