mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-07-05 09:22:04 +02:00
Ditch garbage data ingest for lat/lon and extend map. Closes #63
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
formatRouteLabel,
|
||||
formatRoutingOverrideInput,
|
||||
getEffectiveContactRoute,
|
||||
isValidLocation,
|
||||
resolvePath,
|
||||
formatDistance,
|
||||
formatHopCounts,
|
||||
@@ -665,6 +666,24 @@ describe('resolvePath', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('isValidLocation', () => {
|
||||
it('rejects null and unset coordinates', () => {
|
||||
expect(isValidLocation(null, -122.3)).toBe(false);
|
||||
expect(isValidLocation(47.6, null)).toBe(false);
|
||||
expect(isValidLocation(0, 0)).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects out-of-range coordinates', () => {
|
||||
expect(isValidLocation(-593.497573, -1659.939204)).toBe(false);
|
||||
expect(isValidLocation(91, 0)).toBe(false);
|
||||
expect(isValidLocation(0, 181)).toBe(false);
|
||||
});
|
||||
|
||||
it('accepts sane coordinates', () => {
|
||||
expect(isValidLocation(47.6062, -122.3321)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('formatDistance', () => {
|
||||
it('formats distances under 1km in meters', () => {
|
||||
expect(formatDistance(0.5)).toBe('500m');
|
||||
|
||||
Reference in New Issue
Block a user