mirror of
https://github.com/appy-one/acebase.git
synced 2026-05-26 14:12:15 -06:00
19 lines
No EOL
593 B
JavaScript
19 lines
No EOL
593 B
JavaScript
const { encode, decode, neighbours, adjacent, bounds } = require('../src/geohash');
|
|
|
|
describe('Geohash', () => {
|
|
it('encode', () => {
|
|
let geohash = encode(52.205, 0.119, 7); // geohash: 'u120fxw'
|
|
expect(geohash).toEqual('u120fxw');
|
|
|
|
geohash = encode(52.359157, 4.884155, 8);
|
|
expect(geohash).toBe('u173z5sw');
|
|
});
|
|
|
|
it('decode', () => {
|
|
let coords = decode('u120fxw');
|
|
expect(coords).toEqual({ lat: 52.205, lon: 0.1188 });
|
|
|
|
coords = decode('u173z5sw');
|
|
expect(coords).toEqual({ lat: 52.35921, lon: 4.88428 });
|
|
})
|
|
}) |