mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
add test for ChapmanApiBasedParkingRepositoryLoader.fetchAndUpdateAll
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { beforeEach, describe, expect, it } from "@jest/globals";
|
import { beforeEach, describe, expect, it, jest } from "@jest/globals";
|
||||||
import {
|
import {
|
||||||
ChapmanApiBasedParkingRepositoryLoader
|
ChapmanApiBasedParkingRepositoryLoader
|
||||||
} from "../../../src/loaders/ParkingRepositoryLoaders/ChapmanApiBasedParkingRepositoryLoader";
|
} from "../../../src/loaders/ParkingRepositoryLoaders/ChapmanApiBasedParkingRepositoryLoader";
|
||||||
@@ -24,6 +24,26 @@ describe("ChapmanApiBasedParkingRepositoryLoader", () => {
|
|||||||
resetGlobalFetchMockJson();
|
resetGlobalFetchMockJson();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("fetchAndUpdateAll", () => {
|
||||||
|
it("calls all the correct methods", async () => {
|
||||||
|
const spies = {
|
||||||
|
fetchAndUpdateParkingStructures: jest.spyOn(loader, "fetchAndUpdateParkingStructures"),
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.values(spies).forEach((spy: any) => {
|
||||||
|
spy.mockResolvedValue(undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
await loader.fetchAndUpdateAll();
|
||||||
|
|
||||||
|
Object.values(spies).forEach((spy: any) => {
|
||||||
|
expect(spy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe("fetchAndUpdateParkingStructures", () => {
|
describe("fetchAndUpdateParkingStructures", () => {
|
||||||
it("fetches and update parking structures with unique IDs", async () => {
|
it("fetches and update parking structures with unique IDs", async () => {
|
||||||
updateGlobalFetchMockJson(chapmanParkingStructureData);
|
updateGlobalFetchMockJson(chapmanParkingStructureData);
|
||||||
Reference in New Issue
Block a user