mirror of
https://gitlab.com/mobicoop/v3/service/matcher.git
synced 2026-01-01 07:52:41 +00:00
create ad WIP, extract geography methods to dedicated module
This commit is contained in:
14
src/modules/geography/tests/unit/geo-timezone-finder.spec.ts
Normal file
14
src/modules/geography/tests/unit/geo-timezone-finder.spec.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { GeoTimezoneFinder } from '../../adapters/secondaries/geo-timezone-finder';
|
||||
|
||||
describe('Geo TZ Finder', () => {
|
||||
it('should be defined', () => {
|
||||
const timezoneFinder: GeoTimezoneFinder = new GeoTimezoneFinder();
|
||||
expect(timezoneFinder).toBeDefined();
|
||||
});
|
||||
it('should get timezone for Nancy(France) as Europe/Paris', () => {
|
||||
const timezoneFinder: GeoTimezoneFinder = new GeoTimezoneFinder();
|
||||
const timezones = timezoneFinder.timezones(6.179373, 48.687913);
|
||||
expect(timezones.length).toBe(1);
|
||||
expect(timezones[0]).toBe('Europe/Paris');
|
||||
});
|
||||
});
|
||||
14
src/modules/geography/tests/unit/geodesic.spec.ts
Normal file
14
src/modules/geography/tests/unit/geodesic.spec.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { Geodesic } from '../../adapters/secondaries/geodesic';
|
||||
|
||||
describe('Matcher geodesic', () => {
|
||||
it('should be defined', () => {
|
||||
const geodesic: Geodesic = new Geodesic();
|
||||
expect(geodesic).toBeDefined();
|
||||
});
|
||||
it('should get inverse values', () => {
|
||||
const geodesic: Geodesic = new Geodesic();
|
||||
const inv = geodesic.inverse(0, 0, 1, 1);
|
||||
expect(Math.round(inv.azimuth)).toBe(45);
|
||||
expect(Math.round(inv.distance)).toBe(156900);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user