import React from "react";
import { render } from "@testing-library/react";
import "@testing-library/jest-dom";
import { MapProps } from "../MapProps";
import Map from "../Map";

describe("Map Component", () => {
  const props: MapProps = {
    dataTestId: "test",
    children: "test",
    center: [0, 0],
    className: "test",
    controls: {
      attribution: true,
      navigator: true,
      zoom: true,
    },
    dir: "test",
    maxZoom: 1,
    minSize: 1,
    minZoom: 1,
    pannable: true,
    style: { color: "red" },
    wraparound: true,
    zoom: 1,
    zoomable: true,
    onBeforeReset: jest.fn(),
    onMapClick: jest.fn(),
    onMarkerActivate: jest.fn(),
    onMarkerClick: jest.fn(),
    onMarkerCreated: jest.fn(),
    onPan: jest.fn(),
    onPanEnd: jest.fn(),
    onRefresh: jest.fn(),
    onReset: jest.fn(),
    onShapeClick: jest.fn(),
    onShapeCreated: jest.fn(),
    onShapeFeatureCreated: jest.fn(),
    onShapeMouseEnter: jest.fn(),
    onShapeMouseLeave: jest.fn(),
    onZoomEnd: jest.fn(),
    onZoomStart: jest.fn(),
  };

  it("renders all props correctly", () => {
    render(<Map {...props} />);
  });

  it("matches the snapshot", () => {
    const { asFragment } = render(<Map {...props} />);
    expect(asFragment()).toMatchSnapshot();
  });
});
