diff --git a/client/src/components/frontline/FrontLine.test.tsx b/client/src/components/frontline/FrontLine.test.tsx new file mode 100644 index 00000000..62f4132a --- /dev/null +++ b/client/src/components/frontline/FrontLine.test.tsx @@ -0,0 +1,32 @@ +import { renderWithProviders } from "../../testutils"; +import FrontLine from "./FrontLine"; +import { PolylineProps } from "react-leaflet"; + +const mockPolyline = jest.fn(); +jest.mock("react-leaflet", () => ({ + Polyline: (props: PolylineProps) => { + mockPolyline(props); + }, +})); + +describe("FrontLine", () => { + it("is drawn in the correct location", () => { + const extents = [ + { lat: 0, lng: 0 }, + { lat: 1, lng: 0 }, + ]; + renderWithProviders( + + ); + expect(mockPolyline).toHaveBeenCalledWith( + expect.objectContaining({ + positions: extents, + }) + ); + }); +});