mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
Test that clearShuttleData also clears last stop data
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user