From 7828fa34c11ecbc78256650aed3c8bdfa437e19d Mon Sep 17 00:00:00 2001 From: Tom MacWright Date: Tue, 4 Dec 2012 18:24:55 -0500 Subject: [PATCH] Test nodeIntersect --- test/spec/util.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/spec/util.js b/test/spec/util.js index 07968e7c7..8a23b131a 100644 --- a/test/spec/util.js +++ b/test/spec/util.js @@ -35,6 +35,22 @@ describe('Util', function() { expect(iD.util.geo.interp(a, b, 0)).to.eql({ lat: 0, lon: 0}); }); }); + describe('#nodeIntersect', function() { + it('correctly says that a node is in an extent', function() { + expect(iD.util.geo.nodeIntersect({ + lat: 0, lon: 0 + }, [ + [-180, 90], + [180, -90]])).to.be.true; + }); + it('correctly says that a node is outside of an extent', function() { + expect(iD.util.geo.nodeIntersect({ + lat: 0, lon: 0 + }, [ + [100, 90], + [180, -90]])).to.be.false; + }); + }); describe('#dist', function() { it('distance between two same points is zero', function() { var a = [0, 0],