This commit is contained in:
gili8420 2026-08-14 00:01:49 +09:00
commit b43955e0d9
162 changed files with 15425 additions and 0 deletions

13
tests/unit/geo.test.ts Normal file
View file

@ -0,0 +1,13 @@
import { describe, it, expect } from 'vitest';
import { haversineMeters } from '$domain';
describe('haversineMeters', () => {
it('is zero for identical points', () => {
expect(haversineMeters({ lat: 55, lon: 37 }, { lat: 55, lon: 37 })).toBe(0);
});
it('matches a known great-circle distance (London→Paris ≈ 343 km)', () => {
const d = haversineMeters({ lat: 51.5074, lon: -0.1278 }, { lat: 48.8566, lon: 2.3522 });
expect(d).toBeGreaterThan(340_000);
expect(d).toBeLessThan(346_000);
});
});