Rename properties in WillArriveAtStopPayload for more clarity

This commit is contained in:
2025-11-18 19:14:29 -08:00
parent 0798773bcb
commit 34b2ab05d4
6 changed files with 20 additions and 20 deletions

View File

@@ -406,8 +406,8 @@ export class RedisShuttleRepository extends BaseRedisRepository implements Shutt
shuttleId: shuttle.id, shuttleId: shuttle.id,
}; };
this.emit(ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP, { this.emit(ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP, {
lastArrival: lastStop, lastStopArrival: lastStop,
currentArrival: shuttleArrival, willArriveAt: shuttleArrival,
}); });
await this.updateShuttleLastStopArrival(shuttleArrival); await this.updateShuttleLastStopArrival(shuttleArrival);
} }

View File

@@ -13,8 +13,8 @@ export type EtaRemovedEventPayload = IEta;
export type EtaDataClearedEventPayload = IEta[]; export type EtaDataClearedEventPayload = IEta[];
export interface WillArriveAtStopPayload { export interface WillArriveAtStopPayload {
lastArrival?: ShuttleStopArrival; lastStopArrival?: ShuttleStopArrival;
currentArrival: ShuttleStopArrival; willArriveAt: ShuttleStopArrival;
}; };
export interface ShuttleRepositoryEventPayloads { export interface ShuttleRepositoryEventPayloads {

View File

@@ -187,8 +187,8 @@ export class UnoptimizedInMemoryShuttleRepository
shuttleId: shuttle.id, shuttleId: shuttle.id,
}; };
this.emit(ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP, { this.emit(ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP, {
lastArrival: lastStop, lastStopArrival: lastStop,
currentArrival: shuttleArrival, willArriveAt: shuttleArrival,
}); });
await this.updateShuttleLastStopArrival(shuttleArrival); await this.updateShuttleLastStopArrival(shuttleArrival);
} }

View File

@@ -770,7 +770,7 @@ describe.each(repositoryImplementations)('$name', (holder) => {
expect(listener).toHaveBeenCalledTimes(1); expect(listener).toHaveBeenCalledTimes(1);
const emittedPayload = listener.mock.calls[0][0] as any; const emittedPayload = listener.mock.calls[0][0] as any;
expect(emittedPayload.currentArrival).toEqual({ expect(emittedPayload.willArriveAt).toEqual({
shuttleId: shuttle.id, shuttleId: shuttle.id,
stopId: stop1.id, stopId: stop1.id,
timestamp: arrivalTime, timestamp: arrivalTime,
@@ -824,14 +824,14 @@ describe.each(repositoryImplementations)('$name', (holder) => {
expect(listener).toHaveBeenCalledTimes(2); expect(listener).toHaveBeenCalledTimes(2);
const firstPayload = listener.mock.calls[0][0] as any; const firstPayload = listener.mock.calls[0][0] as any;
expect(firstPayload.currentArrival).toEqual({ expect(firstPayload.willArriveAt).toEqual({
shuttleId: shuttle.id, shuttleId: shuttle.id,
stopId: stop1.id, stopId: stop1.id,
timestamp: firstArrivalTime, timestamp: firstArrivalTime,
}); });
const secondPayload = listener.mock.calls[1][0] as any; const secondPayload = listener.mock.calls[1][0] as any;
expect(secondPayload.currentArrival).toEqual({ expect(secondPayload.willArriveAt).toEqual({
shuttleId: shuttle.id, shuttleId: shuttle.id,
stopId: stop2.id, stopId: stop2.id,
timestamp: secondArrivalTime, timestamp: secondArrivalTime,

View File

@@ -157,8 +157,8 @@ export class InMemorySelfUpdatingETARepository extends BaseInMemoryETARepository
} }
private async handleShuttleWillArriveAtStop({ private async handleShuttleWillArriveAtStop({
lastArrival, lastStopArrival: lastArrival,
currentArrival, willArriveAt: currentArrival,
}: WillArriveAtStopPayload): Promise<void> { }: WillArriveAtStopPayload): Promise<void> {
if (lastArrival) { if (lastArrival) {
// disallow cases where this gets triggered multiple times // disallow cases where this gets triggered multiple times

View File

@@ -179,8 +179,8 @@ export class RedisSelfUpdatingETARepository extends BaseRedisETARepository imple
private async handleShuttleWillArriveAtStop({ private async handleShuttleWillArriveAtStop({
lastArrival, lastStopArrival: lastArrival,
currentArrival, willArriveAt: currentArrival,
}: WillArriveAtStopPayload) { }: WillArriveAtStopPayload) {
// only update time traveled if last arrival exists // only update time traveled if last arrival exists
if (lastArrival) { if (lastArrival) {