diff --git a/src/notifications/schedulers/ETANotificationScheduler.ts b/src/notifications/schedulers/ETANotificationScheduler.ts index 385d350..0f875af 100644 --- a/src/notifications/schedulers/ETANotificationScheduler.ts +++ b/src/notifications/schedulers/ETANotificationScheduler.ts @@ -2,15 +2,22 @@ import { ShuttleGetterRepository } from "../../repositories/ShuttleGetterReposit import { TupleKey } from "../../types/TupleKey"; import { IEta } from "../../entities/entities"; import { AppleNotificationSender, NotificationAlertArguments } from "../senders/AppleNotificationSender"; -import { NotificationLookupArguments, ScheduledNotification } from "../../repositories/NotificationRepository"; +import { + NotificationLookupArguments, + NotificationRepository, + ScheduledNotification +} from "../../repositories/NotificationRepository"; +import { InMemoryNotificationRepository } from "../../repositories/InMemoryNotificationRepository"; type DeviceIdSecondsThresholdAssociation = { [key: string]: number }; export class ETANotificationScheduler { public static readonly defaultSecondsThresholdForNotificationToFire = 180; - constructor(private shuttleRepository: ShuttleGetterRepository, - private appleNotificationSender = new AppleNotificationSender() + constructor( + private shuttleRepository: ShuttleGetterRepository, + private notificationRepository: NotificationRepository = new InMemoryNotificationRepository(), + private appleNotificationSender = new AppleNotificationSender() ) { this.etaSubscriberCallback = this.etaSubscriberCallback.bind(this); this.sendEtaNotificationImmediately = this.sendEtaNotificationImmediately.bind(this);