mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-19 08:50:29 +00:00
Add test case to check that last stop data is removed
This commit is contained in:
@@ -386,6 +386,20 @@ describe.each(repositoryImplementations)('$name', (holder) => {
|
|||||||
expect(remainingShuttles).toHaveLength(mockShuttles.length - 1);
|
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 () => {
|
test("does nothing if shuttle doesn't exist", async () => {
|
||||||
const systemId = "1";
|
const systemId = "1";
|
||||||
const mockShuttles = generateMockShuttles();
|
const mockShuttles = generateMockShuttles();
|
||||||
|
|||||||
Reference in New Issue
Block a user