mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
We need to mock the backend to usefully test the contextmenu handler. I'd like to finish all the low hanging fruit before going for that.
33 lines
709 B
TypeScript
33 lines
709 B
TypeScript
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(
|
|
<FrontLine
|
|
front={{
|
|
id: "",
|
|
extents: extents,
|
|
}}
|
|
/>
|
|
);
|
|
expect(mockPolyline).toHaveBeenCalledWith(
|
|
expect.objectContaining({
|
|
positions: extents,
|
|
})
|
|
);
|
|
});
|
|
});
|