fix test data in ApiBasedRepositoryTests

This commit is contained in:
2025-01-08 16:39:30 -08:00
parent eeadfa62cb
commit a66e0ce9ad

View File

@@ -33,116 +33,118 @@ beforeEach(() => {
// Snapshots taken from the Passio GO! API // Snapshots taken from the Passio GO! API
const genericEtaDataByStopId = { const genericEtaDataByStopId = {
"177666": [ "ETAs": {
{ "177666": [
"OOS": 0, {
"busName": "08", "OOS": 0,
"distance": 1, "busName": "08",
"speed": 10.028535400123669, "distance": 1,
"routeBlockId": "142270", "speed": 10.028535400123669,
"actualRouteBlockId": "142270", "routeBlockId": "142270",
"arrived": null, "actualRouteBlockId": "142270",
"eta": "10 min ", "arrived": null,
"color": "#000000", "eta": "10 min ",
"bg": "#ffea3f", "color": "#000000",
"order": 0, "bg": "#ffea3f",
"dwell": null, "order": 0,
"stopsAmount": 2, "dwell": null,
"secondsSpent": 587, "stopsAmount": 2,
"etaR": "10", "secondsSpent": 587,
"error": null, "etaR": "10",
"outdated": 0, "error": null,
"routeId": "53966", "outdated": 0,
"serviceTime": "", "routeId": "53966",
"scheduleTimes": [], "serviceTime": "",
"goShowSchedule": 0, "scheduleTimes": [],
"looping": "1", "goShowSchedule": 0,
"routeGroupId": "6703", "looping": "1",
"busId": 5577, "routeGroupId": "6703",
"tripId": 751430,
"deviceId": 402840,
"created": "2025-01-07 15:00:09",
"routePointPosition": 6,
"routeStopPosition": 1,
"stopRoutePointPosition": 217,
"timezoneOffset": -10800,
"busLatLng": [
33.7933406,
-117.8539321
],
"busProjectionLatlng": {
"lat": 33.79331052666975,
"lng": -117.85392945849208
},
"busProjectionError": 3,
"stopId": "177666",
"theStop": {
"name": "Chapman Court",
"position": 3,
"userId": "263",
"routeStopId": "1348785",
"busId": 5577, "busId": 5577,
"routeName": "Red Route", "tripId": 751430,
"shortName": null, "deviceId": 402840,
"routeId": "53966", "created": "2025-01-07 15:00:09",
"stopId": "177666" "routePointPosition": 6,
} "routeStopPosition": 1,
}, "stopRoutePointPosition": 217,
{ "timezoneOffset": -10800,
"OOS": 0, "busLatLng": [
"busName": "07", 33.7933406,
"distance": 1, -117.8539321
"speed": 12.160256921380398, ],
"routeBlockId": "142270", "busProjectionLatlng": {
"actualRouteBlockId": "142270", "lat": 33.79331052666975,
"arrived": null, "lng": -117.85392945849208
"eta": "11 min ", },
"color": "#000000", "busProjectionError": 3,
"bg": "#ffea3f", "stopId": "177666",
"order": 0, "theStop": {
"dwell": null, "name": "Chapman Court",
"stopsAmount": 2, "position": 3,
"secondsSpent": 635, "userId": "263",
"etaR": "11", "routeStopId": "1348785",
"error": null, "busId": 5577,
"outdated": 0, "routeName": "Red Route",
"routeId": "53966", "shortName": null,
"serviceTime": "", "routeId": "53966",
"scheduleTimes": [], "stopId": "177666"
"goShowSchedule": 0, }
"looping": "1",
"routeGroupId": "6703",
"busId": 5576,
"tripId": 751430,
"deviceId": 441065,
"created": "2025-01-07 15:00:10",
"routePointPosition": 448,
"routeStopPosition": 4,
"stopRoutePointPosition": 217,
"timezoneOffset": -10800,
"busLatLng": [
33.7933284,
-117.855132
],
"busProjectionLatlng": {
"lat": 33.79332033922653,
"lng": -117.85513217762522
}, },
"busProjectionError": 1, {
"stopId": "177666", "OOS": 0,
"theStop": { "busName": "07",
"name": "Chapman Court", "distance": 1,
"position": 3, "speed": 12.160256921380398,
"userId": "263", "routeBlockId": "142270",
"routeStopId": "1348785", "actualRouteBlockId": "142270",
"busId": 5576, "arrived": null,
"routeName": "Red Route", "eta": "11 min ",
"shortName": null, "color": "#000000",
"bg": "#ffea3f",
"order": 0,
"dwell": null,
"stopsAmount": 2,
"secondsSpent": 635,
"etaR": "11",
"error": null,
"outdated": 0,
"routeId": "53966", "routeId": "53966",
"stopId": "177666" "serviceTime": "",
} "scheduleTimes": [],
}, "goShowSchedule": 0,
] "looping": "1",
"routeGroupId": "6703",
"busId": 5576,
"tripId": 751430,
"deviceId": 441065,
"created": "2025-01-07 15:00:10",
"routePointPosition": 448,
"routeStopPosition": 4,
"stopRoutePointPosition": 217,
"timezoneOffset": -10800,
"busLatLng": [
33.7933284,
-117.855132
],
"busProjectionLatlng": {
"lat": 33.79332033922653,
"lng": -117.85513217762522
},
"busProjectionError": 1,
"stopId": "177666",
"theStop": {
"name": "Chapman Court",
"position": 3,
"userId": "263",
"routeStopId": "1348785",
"busId": 5576,
"routeName": "Red Route",
"shortName": null,
"routeId": "53966",
"stopId": "177666"
}
},
]
},
} }
const genericShuttleDataBySystemId = { const genericShuttleDataBySystemId = {
"alertCRC": "23c1b91c", "alertCRC": "23c1b91c",
@@ -302,9 +304,6 @@ describe("getEtaForShuttleAndStopId", () => {
describe("getEtasForShuttleId", () => { describe("getEtasForShuttleId", () => {
test("getEtasForShuttleId returns correct ETA data", async () => { test("getEtasForShuttleId returns correct ETA data", async () => {
// Because I'm testing updateEtasForSystemIfTTL separately,
// stub it out here
updateGlobalFetchMockJson(genericEtaDataByStopId); updateGlobalFetchMockJson(genericEtaDataByStopId);
const initialCache: ApiBasedRepositoryCache = { const initialCache: ApiBasedRepositoryCache = {