Files
next-tjwater-frontend/src/features/workbench/peripheral-sample/event-location-picker.test.ts
T

17 lines
755 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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("演示路口");
});
});