mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user