diff --git a/src/components/Contexts/VehicleContext.jsx b/src/components/Contexts/VehicleContext.jsx index 3896f9d..e525ef7 100644 --- a/src/components/Contexts/VehicleContext.jsx +++ b/src/components/Contexts/VehicleContext.jsx @@ -89,10 +89,10 @@ export const VehicleProvider = ({ children }) => { } }; - const getLocations = async (token) => { + const getLocations = async (token, mapLocationInfo) => { try { setBusy(true); - const result = await api.getLocations(token); + const result = await api.getLocations(token, mapLocationInfo); if (result.error) throw new Error(`Get locations error. ${result.message}`); return result; diff --git a/src/components/Contexts/VehicleContext.test.jsx b/src/components/Contexts/VehicleContext.test.jsx index a8c79d5..867d8d9 100644 --- a/src/components/Contexts/VehicleContext.test.jsx +++ b/src/components/Contexts/VehicleContext.test.jsx @@ -9,6 +9,7 @@ import { } from "@testing-library/react"; import { VehicleProvider, useVehicleContext } from "./VehicleContext"; import { StatusProvider, useStatusContext } from "./StatusContext"; +import { act } from "react-dom/test-utils"; const checkVehicleResult = (error, busy, vehicle) => { checkBaseResults(error, busy); @@ -437,6 +438,56 @@ describe("VehicleContext", () => { checkBaseResults("", "false"); }); }); + + describe("Get Locations", () => { + var locationFilter = { + center: { + longitude: 0, + latitude: 0 + }, + width: 0, + height: 0 + } + + var locations; + beforeEach(() => { + const TestComp = () => { + const { busy, error, getLocations } = useVehicleContext(); + + return ( + <> +