From 0133acd9005b0c1f757f77ef3e9b6eeb0682f1df Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Sun, 22 Dec 2024 19:59:20 -0800 Subject: [PATCH] update test data with etas --- src/testData.ts | 41 ++++++++++++++++------------------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/src/testData.ts b/src/testData.ts index ff6626d..33af1ae 100644 --- a/src/testData.ts +++ b/src/testData.ts @@ -1,5 +1,5 @@ // Mock data -import { IOrderedStop, IRoute, IShuttle, IStop, ISystem, Repository } from "./repository"; +import { IEta, IOrderedStop, IRoute, IShuttle, IStop, ISystem, Repository } from "./repository"; const systems: ISystem[] = [ { @@ -86,30 +86,18 @@ const shuttles: IShuttle[] = [ } ]; -// const etas: Eta[] = [ -// { -// stop: stops[0], -// shuttle: shuttles[0], -// secondsRemaining: 12.023, -// }, -// { -// stop: stops[1], -// shuttle: shuttles[0], -// secondsRemaining: 600.123, -// } -// ]; - -// shuttles[0].etas = etas; -// -// routes[0].shuttles = shuttles; -// -// systems[0].stops = stops; -// systems[0].routes = routes; -// systems[0].shuttles = shuttles; - -// export function loadTestData(sharedMemory: SharedMemory) { -// sharedMemory.systems = systems; -// } +const etas: IEta[] = [ + { + stopId: stops[0].id, + shuttleId: shuttles[0].id, + secondsRemaining: 12.023, + }, + { + stopId: stops[1].id, + shuttleId: shuttles[0].id, + secondsRemaining: 600.123, + } +]; export async function loadTestData(repository: Repository) { await Promise.all(systems.map(async (system) => { @@ -130,4 +118,7 @@ export async function loadTestData(repository: Repository) { await Promise.all(orderedStopsForTealRoute.map(async (orderedStop) => { await repository.addOrUpdateOrderedStop(orderedStop); })); + await Promise.all(etas.map(async (eta) => { + await repository.addOrUpdateEta(eta); + })); }