From 58890ea40e78781c5eda06247d56c6914f6e8978 Mon Sep 17 00:00:00 2001 From: Alexander Andrews <45926661+alexander-e-andrews@users.noreply.github.com> Date: Mon, 24 Oct 2022 17:31:26 -0400 Subject: [PATCH] CEC-2654: Revert Map polls for current visible area (#222) (#223) Co-authored-by: Alexander Andrews --- src/components/Contexts/VehicleContext.jsx | 4 +- .../Contexts/VehicleContext.test.jsx | 53 ------- .../__snapshots__/index.test.jsx.snap | 130 ------------------ .../__snapshots__/popup.test.jsx.snap | 7 - src/components/VehicleMap/index.jsx | 85 +++++------- src/components/VehicleMap/index.test.jsx | 30 ---- src/components/VehicleMap/popup.jsx | 4 +- src/components/VehicleMap/popup.test.jsx | 43 ------ src/services/__mocks__/vehiclesAPI.js | 8 +- src/services/vehiclesAPI.js | 5 +- 10 files changed, 45 insertions(+), 324 deletions(-) delete mode 100644 src/components/VehicleMap/__snapshots__/index.test.jsx.snap delete mode 100644 src/components/VehicleMap/__snapshots__/popup.test.jsx.snap delete mode 100644 src/components/VehicleMap/index.test.jsx delete mode 100644 src/components/VehicleMap/popup.test.jsx diff --git a/src/components/Contexts/VehicleContext.jsx b/src/components/Contexts/VehicleContext.jsx index e525ef7..3896f9d 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, mapLocationInfo) => { + const getLocations = async (token) => { try { setBusy(true); - const result = await api.getLocations(token, mapLocationInfo); + const result = await api.getLocations(token); 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 867d8d9..a8c79d5 100644 --- a/src/components/Contexts/VehicleContext.test.jsx +++ b/src/components/Contexts/VehicleContext.test.jsx @@ -9,7 +9,6 @@ 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); @@ -438,56 +437,6 @@ 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 ( - <> -
{error}
-
{busy.toString()}
-