diff --git a/src/repositories/InMemoryNotificationRepository.ts b/src/repositories/InMemoryNotificationRepository.ts index d93af1f..bd1db3f 100644 --- a/src/repositories/InMemoryNotificationRepository.ts +++ b/src/repositories/InMemoryNotificationRepository.ts @@ -21,6 +21,16 @@ export class InMemoryNotificationRepository implements NotificationRepository { private listeners: Listener[] = []; + constructor() { + this.getAllNotificationsForShuttleAndStopId = this.getAllNotificationsForShuttleAndStopId.bind(this); + this.getSecondsThresholdForNotificationIfExists = this.getSecondsThresholdForNotificationIfExists.bind(this); + this.deleteNotificationIfExists = this.deleteNotificationIfExists.bind(this); + this.addOrUpdateNotification = this.addOrUpdateNotification.bind(this); + this.isNotificationScheduled = this.isNotificationScheduled.bind(this); + this.subscribeToNotificationChanges = this.subscribeToNotificationChanges.bind(this); + this.unsubscribeFromNotificationChanges = this.unsubscribeFromNotificationChanges.bind(this); + } + async getAllNotificationsForShuttleAndStopId(shuttleId: string, stopId: string) { const tuple = new TupleKey(shuttleId, stopId); if (this.deviceIdsToDeliverTo[tuple.toString()] === undefined) { @@ -51,7 +61,8 @@ export class InMemoryNotificationRepository implements NotificationRepository { } async isNotificationScheduled(lookupArguments: NotificationLookupArguments): Promise { - return await this.getSecondsThresholdForNotificationIfExists(lookupArguments) !== null; + const threshold = await this.getSecondsThresholdForNotificationIfExists(lookupArguments); + return threshold !== null; } async addOrUpdateNotification({