Move testHelpers directory up one level

This commit is contained in:
2025-07-31 22:41:05 -04:00
parent b7299b8359
commit 14fbdc7408
28 changed files with 46 additions and 53 deletions

View File

@@ -0,0 +1,109 @@
import { IEta, IOrderedStop, IRoute, IShuttle, IStop } from "../src/entities/ShuttleRepositoryEntities";
import { IParkingStructure } from "../src/entities/ParkingRepositoryEntities";
// Use a single set of generators in case any of the
// interfaces change in the future
export function generateParkingStructures(): IParkingStructure[] {
// Copied from debugger
return [
{
"capacity": 871,
"coordinates": {
"latitude": 33.7945513,
"longitude": -117.8518707
},
"id": "b0723baf8a6b8bcc37c821473373049e",
"name": "Anderson Structure",
"spotsAvailable": 163,
"address": "300 E Walnut, Orange, CA 92867",
updatedTime: new Date(),
},
{
"capacity": 692,
"coordinates": {
"latitude": 33.792937,
"longitude": -117.854782
},
"id": "81b9e1ed004cf6def2e6c568aaf79ece",
"name": "Barrera",
"spotsAvailable": 179,
"address": "200 W Sycamore Ave, Orange, CA 92866-1053",
updatedTime: new Date(),
}
];
}
export function generateMockShuttles(): IShuttle[] {
return [
{
id: "sh1",
name: "Shuttle A",
routeId: "r1",
systemId: "sys1",
coordinates: {
latitude: 10,
longitude: 20
},
orientationInDegrees: 25.163,
updatedTime: new Date(),
},
{
id: "sh2",
name: "Shuttle B",
routeId: "r2",
systemId: "sys2",
coordinates: {
latitude: 15,
longitude: 25
},
orientationInDegrees: 50.912,
updatedTime: new Date(),
},
{
id: "sh3",
name: "Shuttle C",
routeId: "r3",
systemId: "sys3",
coordinates: {
latitude: 30,
longitude: 40
},
orientationInDegrees: 321.019,
updatedTime: new Date(),
},
];
}
export function generateMockRoutes(): IRoute[] {
return [
{ id: "r1", name: "Route 1", color: "red", systemId: "sys1", polylineCoordinates: [], updatedTime: new Date() },
{ id: "r2", name: "Route 2", color: "blue", systemId: "sys2", polylineCoordinates: [], updatedTime: new Date() },
{ id: "r3", name: "Route 3", color: "green", systemId: "sys3", polylineCoordinates: [], updatedTime: new Date() },
];
}
export function generateMockStops(): IStop[] {
return [
{ id: "st1", name: "Stop A", systemId: "sys1", coordinates: { latitude: 10, longitude: 20 }, updatedTime: new Date() },
{ id: "st2", name: "Stop B", systemId: "sys2", coordinates: { latitude: 15, longitude: 25 }, updatedTime: new Date() },
{ id: "st3", name: "Stop C", systemId: "sys3", coordinates: { latitude: 30, longitude: 40 }, updatedTime: new Date() },
];
}
export function generateMockOrderedStops(): IOrderedStop[] {
return [
{ stopId: "st1", routeId: "r1", position: 1, systemId: "sys1", updatedTime: new Date(), },
{ stopId: "st1", routeId: "r2", position: 2, systemId: "sys1", updatedTime: new Date(), },
{ stopId: "st2", routeId: "r1", position: 3, systemId: "sys1", updatedTime: new Date(), },
{ stopId: "st2", routeId: "r2", position: 4, systemId: "sys1", updatedTime: new Date(), },
];
}
export function generateMockEtas(): IEta[] {
return [
{ shuttleId: "sh1", stopId: "st1", secondsRemaining: 120, systemId: "sys1", updatedTime: new Date() },
{ shuttleId: "sh1", stopId: "st2", secondsRemaining: 180, systemId: "sys1", updatedTime: new Date() },
{ shuttleId: "sh2", stopId: "st3", secondsRemaining: 240, systemId: "sys1", updatedTime: new Date() },
];
}