diff --git a/spec/ParsePolygon.spec.js b/spec/ParsePolygon.spec.js index 19091ce7cd..0ceb94b0c3 100644 --- a/spec/ParsePolygon.spec.js +++ b/spec/ParsePolygon.spec.js @@ -9,8 +9,8 @@ const defaultHeaders = { describe('Parse.Polygon testing', () => { it('polygon save open path', (done) => { - const coords = [[0,0],[0,1],[1,1],[1,0]]; - const closed = [[0,0],[0,1],[1,1],[1,0],[0,0]]; + const coords = [[0,0],[0,1],[1,2],[1,0]]; + const closed = [[0,0],[0,1],[1,2],[1,0],[0,0]]; const obj = new TestObject(); obj.set('polygon', new Parse.Polygon(coords)); return obj.save().then(() => { @@ -25,7 +25,7 @@ describe('Parse.Polygon testing', () => { }); it('polygon save closed path', (done) => { - const coords = [[0,0],[0,1],[1,1],[1,0],[0,0]]; + const coords = [[0,0],[0,1],[1,2],[1,0],[0,0]]; const obj = new TestObject(); obj.set('polygon', new Parse.Polygon(coords)); return obj.save().then(() => { @@ -40,8 +40,8 @@ describe('Parse.Polygon testing', () => { }); it('polygon equalTo (open/closed) path', (done) => { - const openPoints = [[0,0],[0,1],[1,1],[1,0]]; - const closedPoints = [[0,0],[0,1],[1,1],[1,0],[0,0]]; + const openPoints = [[0,0],[0,1],[1,2],[1,0]]; + const closedPoints = [[0,0],[0,1],[1,2],[1,0],[0,0]]; const openPolygon = new Parse.Polygon(openPoints); const closedPolygon = new Parse.Polygon(closedPoints); const obj = new TestObject(); @@ -66,9 +66,9 @@ describe('Parse.Polygon testing', () => { }); it('polygon update', (done) => { - const oldCoords = [[0,0],[0,1],[1,1],[1,0]]; + const oldCoords = [[0,0],[0,1],[1,2],[1,0]]; const oldPolygon = new Parse.Polygon(oldCoords); - const newCoords = [[2,2],[2,3],[3,3],[3,2]]; + const newCoords = [[2,2],[2,3],[3,5],[3,2]]; const newPolygon = new Parse.Polygon(newCoords); const obj = new TestObject(); obj.set('polygon', oldPolygon); @@ -88,7 +88,7 @@ describe('Parse.Polygon testing', () => { }); it('polygon invalid value', (done) => { - const coords = [['foo','bar'],[0,1],[1,0],[1,1],[0,0]]; + const coords = [['foo','bar'],[0,1],[1,0],[1,2],[0,0]]; const obj = new TestObject(); obj.set('polygon', {__type: 'Polygon', coordinates: coords}); return obj.save().then(() => { @@ -129,7 +129,7 @@ describe('Parse.Polygon testing', () => { }); it('polygonContain query', (done) => { - const points1 = [[0,0],[0,1],[1,1],[1,0]]; + const points1 = [[.25,0],[.25,1.25],[.75,1.25],[.75,0]]; const points2 = [[0,0],[0,2],[2,2],[2,0]]; const points3 = [[10,10],[10,15],[15,15],[15,10],[10,10]]; const polygon1 = new Parse.Polygon(points1); @@ -142,7 +142,7 @@ describe('Parse.Polygon testing', () => { const where = { location: { $geoIntersects: { - $point: { __type: 'GeoPoint', latitude: 0.5, longitude: 0.5 } + $point: { __type: 'GeoPoint', latitude: 0.5, longitude:1.0 } } } }; @@ -184,7 +184,7 @@ describe('Parse.Polygon testing', () => { }); it('polygonContain invalid geoPoint', (done) => { - const points = [[0,0],[0,1],[1,1],[1,0]]; + const points = [[0,0],[0,1],[1,2],[1,0]]; const polygon = new Parse.Polygon(points); const obj = new TestObject({location: polygon}); obj.save().then(() => { @@ -209,7 +209,7 @@ describe('Parse.Polygon testing', () => { describe_only_db('mongo')('Parse.Polygon testing', () => { it('support 2d and 2dsphere', (done) => { - const coords = [[0,0],[0,1],[1,1],[1,0],[0,0]]; + const coords = [[0,0],[0,1],[1,2],[1,0],[0,0]]; // testings against REST API, use raw formats const polygon = {__type: 'Polygon', coordinates: coords}; const location = {__type: 'GeoPoint', latitude:10, longitude:10}; @@ -256,7 +256,7 @@ describe_only_db('mongo')('Parse.Polygon testing', () => { }); it('polygon loop is not valid', (done) => { - const coords = [[0,0],[0,1],[1,0],[1,1]]; + const coords = [[0,0],[0,1],[1,0],[1,2]]; const obj = new TestObject(); obj.set('polygon', new Parse.Polygon(coords)); obj.save().then(done.fail, done);