markers.test.js 972 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. import {
  2. makeFlagMarker,
  3. makeLine,
  4. makeQuestionMarker,
  5. } from "../hooks/useMarkersFromGuesses/markers";
  6. describe("markers", () => {
  7. describe("makeLine", () => {
  8. it("makes a line", () => {
  9. const result = makeLine("p1", "p2", "map", "color");
  10. expect(result).toMatchSnapshot();
  11. });
  12. });
  13. describe("makeQuestionMarker", () => {
  14. it("makes a question marker", () => {
  15. const result = makeQuestionMarker(
  16. "map",
  17. { lat: "lat", lng: "lng" },
  18. "title",
  19. "color"
  20. );
  21. expect(result).toMatchSnapshot();
  22. result.listeners.get("click")[0]();
  23. expect(global.window.open).toHaveBeenCalledWith(
  24. "https://www.google.com/maps?hl=en&q=+lat,+lng",
  25. "_blank"
  26. );
  27. });
  28. });
  29. describe("makeFlagMarker", () => {
  30. it("makes a flag marker", () => {
  31. const result = makeFlagMarker("map", { lat: "lat", lng: "lng" });
  32. expect(result).toMatchSnapshot();
  33. });
  34. });
  35. });