diff --git a/src/repositories/shuttle/__tests__/ShuttleRepositorySharedTests.test.ts b/src/repositories/shuttle/__tests__/ShuttleRepositorySharedTests.test.ts index b45f2a3..038ea56 100644 --- a/src/repositories/shuttle/__tests__/ShuttleRepositorySharedTests.test.ts +++ b/src/repositories/shuttle/__tests__/ShuttleRepositorySharedTests.test.ts @@ -18,7 +18,7 @@ class UnoptimizedInMemoryShuttleRepositoryHolder implements RepositoryHolder { return new UnoptimizedInMemoryShuttleRepository(); }; - teardown = async () => {}; + teardown = async () => { }; } class RedisShuttleRepositoryHolder implements RepositoryHolder { @@ -477,6 +477,28 @@ describe.each(repositoryImplementations)('$name', (holder) => { const result = await repository.getShuttles(); expect(result).toEqual([]); }); + + test("also clears last stop data", async () => { + const { route, stop1, stop2, systemId } = await setupRouteAndOrderedStops(); + + const mockShuttles = generateMockShuttles(); + mockShuttles[0].coordinates = stop1.coordinates; + mockShuttles[1].coordinates = stop2.coordinates; + + for (const shuttle of mockShuttles) { + shuttle.routeId = route.id; + shuttle.systemId = systemId; + + await repository.addOrUpdateShuttle(shuttle); + } + + await repository.clearShuttleData(); + + for (const shuttle of mockShuttles) { + const result = await repository.getShuttleLastStopArrival(shuttle.id); + expect(result).toBeUndefined(); + } + }); });