X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/0de6885a91e1740e3e2740287cb2d576de827844..881015036ca9e65a21d654013b2b2c278390a536:/test/javascripts/osm_test.js?ds=inline diff --git a/test/javascripts/osm_test.js b/test/javascripts/osm_test.js index f26f08c9f..51f74fe7a 100644 --- a/test/javascripts/osm_test.js +++ b/test/javascripts/osm_test.js @@ -239,4 +239,14 @@ describe("OSM", function () { expect(OSM.locationCookie(map)).to.eq("-3.685|57.625|5|M"); }); }); + + describe(".distance", function () { + it("computes distance between points", function () { + var latlng1 = L.latLng(51.76712,-0.00484), + latlng2 = L.latLng(51.7675159, -0.0078329); + + expect(OSM.distance(latlng1, latlng2)).to.be.closeTo(210.664, 0.005); + expect(OSM.distance(latlng2, latlng1)).to.be.closeTo(210.664, 0.005); + }); + }); });