diff --git a/client/src/components/aircraft/Aircraft.test.tsx b/client/src/components/aircraft/Aircraft.test.tsx new file mode 100644 index 00000000..959efb1f --- /dev/null +++ b/client/src/components/aircraft/Aircraft.test.tsx @@ -0,0 +1,53 @@ +import Aircraft from "./Aircraft"; +import { render } from "@testing-library/react"; +import { Icon } from "leaflet"; + +const mockMarker = jest.fn(); +jest.mock("react-leaflet", () => ({ + Marker: (props: any) => { + mockMarker(props); + }, +})); + +test("grounded aircraft do not render", async () => { + const { container } = render( + + ); + + expect(container).toBeEmptyDOMElement(); +}); + +test("in-flight aircraft render", async () => { + render( + + ); + + expect(mockMarker).toHaveBeenCalledWith( + expect.objectContaining({ + position: { + lat: 10, + lng: 20, + }, + icon: expect.any(Icon), + }) + ); +});