Change ParkingStructureCountOptions and HistoricalParkingAverageQueryResult to use Date objects

This matches the behavior of `updatedTime` on shuttle objects. When returning API data, dates are converted into milliseconds since Epoch by the DateTime scalar implementation.
This commit is contained in:
2025-07-19 12:12:08 -04:00
parent ed037cf2d2
commit 8ee1f1522e
6 changed files with 30 additions and 26 deletions

View File

@@ -152,8 +152,8 @@ describe.each(repositoryImplementations)('$name', (holder) => {
describe("getHistoricalAveragesOfParkingStructureCounts", () => {
it("should return empty array for non-existent structure or no data", async () => {
const options: ParkingStructureCountOptions = {
startUnixEpochMs: 1000,
endUnixEpochMs: 2000,
startUnixEpochMs: new Date(1000),
endUnixEpochMs: new Date(2000),
intervalMs: 500
};
@@ -183,8 +183,8 @@ describe.each(repositoryImplementations)('$name', (holder) => {
const now = Date.now();
const options: ParkingStructureCountOptions = {
startUnixEpochMs: now - 10000, // Look back 10 seconds
endUnixEpochMs: now + 10000, // Look forward 10 seconds
startUnixEpochMs: new Date(now - 10000), // Look back 10 seconds
endUnixEpochMs: new Date(now + 10000), // Look forward 10 seconds
intervalMs: 20000 // Single large interval
};
@@ -195,6 +195,8 @@ describe.each(repositoryImplementations)('$name', (holder) => {
if (result.length > 0) {
expect(result[0]).toHaveProperty('fromUnixEpochMs');
expect(result[0]).toHaveProperty('toUnixEpochMs');
expect(result[0].fromUnixEpochMs).toBeInstanceOf(Date);
expect(result[0].toUnixEpochMs).toBeInstanceOf(Date);
expect(result[0]).toHaveProperty('averageSpotsAvailable');
expect(result[0].averageSpotsAvailable).toBeCloseTo(52.5);
}