Add test case to check that last stop data is removed

This commit is contained in:
2025-11-14 10:23:02 -08:00
parent f76126c951
commit 1511b3c118

View File

@@ -386,6 +386,20 @@ describe.each(repositoryImplementations)('$name', (holder) => {
expect(remainingShuttles).toHaveLength(mockShuttles.length - 1);
});
test("removes shuttle last stop if exists", async () => {
const { route, stop1, systemId } = await setupRouteAndOrderedStops();
const mockShuttle = generateMockShuttles()[0];
mockShuttle.routeId = route.id;
mockShuttle.coordinates = stop1.coordinates;
mockShuttle.systemId = systemId;
await repository.addOrUpdateShuttle(mockShuttle);
await repository.removeShuttleIfExists(mockShuttle.id);
const lastStopData = await repository.getShuttleLastStopArrival(mockShuttle.id);
expect(lastStopData).toBeUndefined();
});
test("does nothing if shuttle doesn't exist", async () => {
const systemId = "1";
const mockShuttles = generateMockShuttles();