다음으로 매개변수가 객체로 바뀌었으니 생성자 함수의 코드도 변경해야 한다.
// stub-time/02-inject-object/password-verifier-time02.js
const SUNDAY = 0, MONDAY = 1, SATURDAY = 6;
class PasswordVerifier {
constructor(rules, timeProvider) {
this.rules = rules;
this.timeProvider = timeProvider;
}
verify(input) {
if ([SATURDAY, SUNDAY].includes(this.timeProvider.getDay())) {
throw new Error("It's the weekend!");
}
// ...
}
}