import { describe, expect, it } from "vitest"; import { formatGpsCoordinate, mergeEventLocation } from "./event-location-coordinate"; describe("event location GPS formatting", () => { it("formats coordinates with stable GPS precision", () => { expect(formatGpsCoordinate([121.4791234, 31.2359876])).toBe("121.479123, 31.235988"); }); it("keeps the written location and persists the selected coordinate", () => { expect(mergeEventLocation(" 演示路口 ", [121.4791234, 31.2359876])) .toBe("演示路口(GPS:121.479123, 31.235988)"); expect(mergeEventLocation("", [121.4791234, 31.2359876])) .toBe("GPS:121.479123, 31.235988"); expect(mergeEventLocation(" 演示路口 ", null)).toBe("演示路口"); }); });