mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
update tests and mock data generators
This commit is contained in:
@@ -59,6 +59,7 @@ describe("ChapmanApiBasedParkingRepositoryLoader", () => {
|
|||||||
},
|
},
|
||||||
name: "Anderson Structure",
|
name: "Anderson Structure",
|
||||||
id: "",
|
id: "",
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
address: "200 W Sycamore Ave, Orange, CA 92866-1053",
|
address: "200 W Sycamore Ave, Orange, CA 92866-1053",
|
||||||
@@ -70,6 +71,7 @@ describe("ChapmanApiBasedParkingRepositoryLoader", () => {
|
|||||||
},
|
},
|
||||||
name: "Barrera",
|
name: "Barrera",
|
||||||
id: "",
|
id: "",
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
expectedStructures[0].id = ChapmanApiBasedParkingRepositoryLoader.generateId(expectedStructures[0].address);
|
expectedStructures[0].id = ChapmanApiBasedParkingRepositoryLoader.generateId(expectedStructures[0].address);
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ describe("ETANotificationScheduler", () => {
|
|||||||
stopId: stop.id,
|
stopId: stop.id,
|
||||||
secondsRemaining: 120,
|
secondsRemaining: 120,
|
||||||
systemId: "1",
|
systemId: "1",
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
};
|
};
|
||||||
|
|
||||||
const notificationData1 = {
|
const notificationData1 = {
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ describe("InMemoryParkingRepository", () => {
|
|||||||
id: "1",
|
id: "1",
|
||||||
name: "Anderson Parking Structure",
|
name: "Anderson Parking Structure",
|
||||||
capacity: 100,
|
capacity: 100,
|
||||||
address: "300 E Walnut Ave, Orange, CA 92867"
|
address: "300 E Walnut Ave, Orange, CA 92867",
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
};
|
};
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ export function generateParkingStructures(): IParkingStructure[] {
|
|||||||
"id": "b0723baf8a6b8bcc37c821473373049e",
|
"id": "b0723baf8a6b8bcc37c821473373049e",
|
||||||
"name": "Anderson Structure",
|
"name": "Anderson Structure",
|
||||||
"spotsAvailable": 163,
|
"spotsAvailable": 163,
|
||||||
"address": "300 E Walnut, Orange, CA 92867"
|
"address": "300 E Walnut, Orange, CA 92867",
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"capacity": 692,
|
"capacity": 692,
|
||||||
@@ -27,7 +28,8 @@ export function generateParkingStructures(): IParkingStructure[] {
|
|||||||
"id": "81b9e1ed004cf6def2e6c568aaf79ece",
|
"id": "81b9e1ed004cf6def2e6c568aaf79ece",
|
||||||
"name": "Barrera",
|
"name": "Barrera",
|
||||||
"spotsAvailable": 179,
|
"spotsAvailable": 179,
|
||||||
"address": "200 W Sycamore Ave, Orange, CA 92866-1053"
|
"address": "200 W Sycamore Ave, Orange, CA 92866-1053",
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@@ -43,7 +45,8 @@ export function generateMockShuttles(): IShuttle[] {
|
|||||||
latitude: 10,
|
latitude: 10,
|
||||||
longitude: 20
|
longitude: 20
|
||||||
},
|
},
|
||||||
orientationInDegrees: 25.163
|
orientationInDegrees: 25.163,
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "sh2",
|
id: "sh2",
|
||||||
@@ -54,7 +57,8 @@ export function generateMockShuttles(): IShuttle[] {
|
|||||||
latitude: 15,
|
latitude: 15,
|
||||||
longitude: 25
|
longitude: 25
|
||||||
},
|
},
|
||||||
orientationInDegrees: 50.912
|
orientationInDegrees: 50.912,
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "sh3",
|
id: "sh3",
|
||||||
@@ -65,40 +69,41 @@ export function generateMockShuttles(): IShuttle[] {
|
|||||||
latitude: 30,
|
latitude: 30,
|
||||||
longitude: 40
|
longitude: 40
|
||||||
},
|
},
|
||||||
orientationInDegrees: 321.019
|
orientationInDegrees: 321.019,
|
||||||
|
updatedTimeMs: Date.now(),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateMockRoutes(): IRoute[] {
|
export function generateMockRoutes(): IRoute[] {
|
||||||
return [
|
return [
|
||||||
{ id: "r1", name: "Route 1", color: "red", systemId: "sys1", polylineCoordinates: [] },
|
{ id: "r1", name: "Route 1", color: "red", systemId: "sys1", polylineCoordinates: [], updatedTimeMs: Date.now() },
|
||||||
{ id: "r2", name: "Route 2", color: "blue", systemId: "sys2", polylineCoordinates: [] },
|
{ id: "r2", name: "Route 2", color: "blue", systemId: "sys2", polylineCoordinates: [], updatedTimeMs: Date.now() },
|
||||||
{ id: "r3", name: "Route 3", color: "green", systemId: "sys3", polylineCoordinates: [] },
|
{ id: "r3", name: "Route 3", color: "green", systemId: "sys3", polylineCoordinates: [], updatedTimeMs: Date.now() },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateMockStops(): IStop[] {
|
export function generateMockStops(): IStop[] {
|
||||||
return [
|
return [
|
||||||
{ id: "st1", name: "Stop A", systemId: "sys1", coordinates: { latitude: 10, longitude: 20 } },
|
{ id: "st1", name: "Stop A", systemId: "sys1", coordinates: { latitude: 10, longitude: 20 }, updatedTimeMs: Date.now() },
|
||||||
{ id: "st2", name: "Stop B", systemId: "sys2", coordinates: { latitude: 15, longitude: 25 } },
|
{ id: "st2", name: "Stop B", systemId: "sys2", coordinates: { latitude: 15, longitude: 25 }, updatedTimeMs: Date.now() },
|
||||||
{ id: "st3", name: "Stop C", systemId: "sys3", coordinates: { latitude: 30, longitude: 40 } },
|
{ id: "st3", name: "Stop C", systemId: "sys3", coordinates: { latitude: 30, longitude: 40 }, updatedTimeMs: Date.now() },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateMockOrderedStops(): IOrderedStop[] {
|
export function generateMockOrderedStops(): IOrderedStop[] {
|
||||||
return [
|
return [
|
||||||
{ stopId: "st1", routeId: "r1", position: 1, systemId: "sys1" },
|
{ stopId: "st1", routeId: "r1", position: 1, systemId: "sys1", updatedTimeMs: Date.now(), },
|
||||||
{ stopId: "st1", routeId: "r2", position: 2, systemId: "sys1" },
|
{ stopId: "st1", routeId: "r2", position: 2, systemId: "sys1", updatedTimeMs: Date.now(), },
|
||||||
{ stopId: "st2", routeId: "r1", position: 3, systemId: "sys1" },
|
{ stopId: "st2", routeId: "r1", position: 3, systemId: "sys1", updatedTimeMs: Date.now(), },
|
||||||
{ stopId: "st2", routeId: "r2", position: 4, systemId: "sys1" },
|
{ stopId: "st2", routeId: "r2", position: 4, systemId: "sys1", updatedTimeMs: Date.now(), },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function generateMockEtas(): IEta[] {
|
export function generateMockEtas(): IEta[] {
|
||||||
return [
|
return [
|
||||||
{ shuttleId: "sh1", stopId: "st1", secondsRemaining: 120, systemId: "sys1" },
|
{ shuttleId: "sh1", stopId: "st1", secondsRemaining: 120, systemId: "sys1", updatedTimeMs: Date.now() },
|
||||||
{ shuttleId: "sh1", stopId: "st2", secondsRemaining: 180, systemId: "sys1" },
|
{ shuttleId: "sh1", stopId: "st2", secondsRemaining: 180, systemId: "sys1", updatedTimeMs: Date.now() },
|
||||||
{ shuttleId: "sh2", stopId: "st3", secondsRemaining: 240, systemId: "sys1" },
|
{ shuttleId: "sh2", stopId: "st3", secondsRemaining: 240, systemId: "sys1", updatedTimeMs: Date.now() },
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user