Change the event name to SHUTTLE_WILL_ARRIVE_AT_STOP, and emit it before the stop is updated

This commit is contained in:
2025-11-11 19:10:13 -08:00
parent b9fefcc6a9
commit 9af50ddfe9
5 changed files with 12 additions and 11 deletions

View File

@@ -712,12 +712,12 @@ describe.each(repositoryImplementations)('$name', (holder) => {
});
});
describe("SHUTTLE_ARRIVED_AT_STOP event", () => {
test("emits SHUTTLE_ARRIVED_AT_STOP event when shuttle arrives at a stop", async () => {
describe("SHUTTLE_WILL_ARRIVE_AT_STOP event", () => {
test("emits SHUTTLE_WILL_ARRIVE_AT_STOP event before shuttle arrives at a stop", async () => {
const { route, systemId, stop1 } = await setupRouteAndOrderedStops();
const listener = jest.fn();
repository.on(ShuttleRepositoryEvent.SHUTTLE_ARRIVED_AT_STOP, listener);
repository.on(ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP, listener);
const shuttle = {
id: "sh1",
@@ -743,7 +743,7 @@ describe.each(repositoryImplementations)('$name', (holder) => {
const { route, systemId } = await setupRouteAndOrderedStops();
const listener = jest.fn();
repository.on(ShuttleRepositoryEvent.SHUTTLE_ARRIVED_AT_STOP, listener);
repository.on(ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP, listener);
const shuttle = {
id: "sh1",
@@ -764,7 +764,7 @@ describe.each(repositoryImplementations)('$name', (holder) => {
const { route, systemId, stop1, stop2 } = await setupRouteAndOrderedStops();
const listener = jest.fn();
repository.on(ShuttleRepositoryEvent.SHUTTLE_ARRIVED_AT_STOP, listener);
repository.on(ShuttleRepositoryEvent.SHUTTLE_WILL_ARRIVE_AT_STOP, listener);
const shuttle = {
id: "sh1",