add functionality to normalize the spots available if over capacity

This commit is contained in:
2025-04-16 17:18:48 -07:00
parent 658222b91a
commit 02e440773a
2 changed files with 18 additions and 4 deletions

View File

@@ -42,8 +42,6 @@ describe("ChapmanApiBasedParkingRepositoryLoader", () => {
});
});
describe("fetchAndUpdateParkingStructures", () => {
it("fetches and update parking structures with unique IDs", async () => {
updateGlobalFetchMockJson(chapmanParkingStructureData);
@@ -89,4 +87,20 @@ describe("ChapmanApiBasedParkingRepositoryLoader", () => {
});
})
});
describe("constructIParkingStructureFromJson", () => {
it("normalizes the spots available if it's over the capacity", async () => {
const sampleJsonStructure: any = {
Capacity: 10,
Latitude: 1,
Longitude: 1,
Address: "300 E Walnut, Orange, CA 92867",
Name: "Anderson Structure",
CurrentCount: 11,
};
const returnedStructure = loader.constructIParkingStructureFromJson(sampleJsonStructure);
expect(returnedStructure.spotsAvailable).toEqual(returnedStructure.capacity);
});
});
});