Files
nodeMap/__tests__/unit/components/gisPolylines/icons/StartIcon.test.js
2024-08-10 10:32:37 +02:00

42 lines
1.2 KiB
JavaScript

// __tests__/components/gisPolylines/icons/StartIcon.test.js
jest.mock("leaflet", () => {
const actualLeaflet = jest.requireActual("leaflet");
return {
...actualLeaflet,
DivIcon: jest.fn().mockImplementation((options) => ({
...options,
options,
_leaflet_id: Math.random(),
_createIcon: jest.fn(),
_createImg: jest.fn(),
_getIconUrl: jest.fn(),
_initHooks: [],
_initHooksCalled: true,
_setIconStyles: jest.fn(),
callInitHooks: jest.fn(),
createIcon: jest.fn(),
createShadow: jest.fn(),
initialize: jest.fn(),
})),
};
});
import L from "leaflet";
import StartIcon from "../../../../../components/gisPolylines/icons/StartIcon";
describe("StartIcon", () => {
test("should be a Leaflet divIcon with correct properties", () => {
//console.log("StartIcon options:", StartIcon.options);
expect(StartIcon).toEqual(
expect.objectContaining({
options: expect.objectContaining({
className: "custom-start-icon",
html: expect.stringContaining("<svg"),
iconSize: [18, 18],
iconAnchor: [9, 10],
}),
})
);
});
});