Initial Watermaps import
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { haversineDistanceNm, initialBearingDeg, normalizeHeadingDeg } from "../src/index.js";
|
||||
|
||||
describe("geo helpers", () => {
|
||||
it("calculates a practical nautical-mile distance", () => {
|
||||
const distance = haversineDistanceNm(
|
||||
{ lat: 53.541, lon: 9.966 },
|
||||
{ lat: 54.18, lon: 12.09 }
|
||||
);
|
||||
|
||||
expect(distance).toBeGreaterThan(80);
|
||||
expect(distance).toBeLessThan(95);
|
||||
});
|
||||
|
||||
it("normalizes headings and bearings", () => {
|
||||
expect(normalizeHeadingDeg(-10)).toBe(350);
|
||||
expect(normalizeHeadingDeg(370)).toBe(10);
|
||||
expect(initialBearingDeg({ lat: 53.5, lon: 9.9 }, { lat: 54, lon: 10.1 })).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user