// Tests that run exclusively for the in-memory repo import { beforeEach, describe, expect, it, jest } from "@jest/globals"; import { InMemoryParkingRepository } from "../../src/repositories/parking/InMemoryParkingRepository"; describe("InMemoryParkingRepositoryTests", () => { let repository = new InMemoryParkingRepository(); beforeEach(() => { repository = new InMemoryParkingRepository(); }); describe("getHistoricalAveragesOfParkingStructureCounts", () => { it("gets correct data for historical averages", async () => { // jest.useFakeTimers(); // jest.setSystemTime(new Date()); // // const parkingStructure = generateParkingStructures()[0]; // parkingStructure.spotsAvailable = parkingStructure.capacity; // mockSystem.parkingRepository?.setLoggingInterval(100); // // // Simulate repeated updates // for (let i = 0; i < 6; i += 1) { // jest.setSystemTime(new Date(Date.now() + 1000)); // parkingStructure.spotsAvailable = parkingStructure.spotsAvailable - 100; // parkingStructureCounts.push(parkingStructure.spotsAvailable); // await mockSystem.parkingRepository?.addOrUpdateParkingStructure(parkingStructure); // } // TODO: Make these assertions for this repository // expect(historicalAverages[0].averageSpotsAvailable).toBeCloseTo((parkingStructureCounts[0] + parkingStructureCounts[1]) / 2); // expect(historicalAverages[1].averageSpotsAvailable).toBeCloseTo((parkingStructureCounts[2] + parkingStructureCounts[3]) / 2); // expect(historicalAverages[2].averageSpotsAvailable).toBeCloseTo((parkingStructureCounts[4] + parkingStructureCounts[5]) / 2); }); }); });