add test and implementation for addOrUpdate listeners

This commit is contained in:
2025-03-27 11:23:07 -07:00
parent 51d66d8886
commit a84cedd05a
2 changed files with 45 additions and 3 deletions

View File

@@ -66,6 +66,19 @@ export class InMemoryNotificationRepository implements NotificationRepository {
}
this.deviceIdsToDeliverTo[tuple.toString()][deviceId] = secondsThreshold;
this.listeners.forEach((listener: Listener) => {
const event: NotificationEvent = {
event: 'addOrUpdate',
notification: {
shuttleId,
stopId,
deviceId,
secondsThreshold
},
}
listener(event);
})
}
async deleteNotificationIfExists({