mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add functionality to normalize the spots available if over capacity
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user