Bumps parse sdk 1.10.1 (#4274)
* Fail test case for Issue#3999 * no message * Bumps Parse to 1.10.1 Updates Polygon test suite to leverage latest version
This commit is contained in:
@@ -29,7 +29,7 @@
|
|||||||
"mime": "1.4.0",
|
"mime": "1.4.0",
|
||||||
"mongodb": "2.2.33",
|
"mongodb": "2.2.33",
|
||||||
"multer": "1.3.0",
|
"multer": "1.3.0",
|
||||||
"parse": "1.10.0",
|
"parse": "1.10.1",
|
||||||
"parse-server-fs-adapter": "1.0.1",
|
"parse-server-fs-adapter": "1.0.1",
|
||||||
"parse-server-push-adapter": "2.0.1",
|
"parse-server-push-adapter": "2.0.1",
|
||||||
"parse-server-s3-adapter": "1.2.0",
|
"parse-server-s3-adapter": "1.2.0",
|
||||||
|
|||||||
@@ -12,13 +12,13 @@ describe('Parse.Polygon testing', () => {
|
|||||||
const coords = [[0,0],[0,1],[1,1],[1,0]];
|
const coords = [[0,0],[0,1],[1,1],[1,0]];
|
||||||
const closed = [[0,0],[0,1],[1,1],[1,0],[0,0]];
|
const closed = [[0,0],[0,1],[1,1],[1,0],[0,0]];
|
||||||
const obj = new TestObject();
|
const obj = new TestObject();
|
||||||
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
|
obj.set('polygon', new Parse.Polygon(coords));
|
||||||
return obj.save().then(() => {
|
return obj.save().then(() => {
|
||||||
const query = new Parse.Query(TestObject);
|
const query = new Parse.Query(TestObject);
|
||||||
return query.get(obj.id);
|
return query.get(obj.id);
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
const polygon = result.get('polygon');
|
const polygon = result.get('polygon');
|
||||||
equal(polygon.__type, 'Polygon');
|
equal(polygon instanceof Parse.Polygon, true);
|
||||||
equal(polygon.coordinates, closed);
|
equal(polygon.coordinates, closed);
|
||||||
done();
|
done();
|
||||||
}, done.fail);
|
}, done.fail);
|
||||||
@@ -27,13 +27,13 @@ describe('Parse.Polygon testing', () => {
|
|||||||
it('polygon save closed path', (done) => {
|
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,1],[1,0],[0,0]];
|
||||||
const obj = new TestObject();
|
const obj = new TestObject();
|
||||||
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
|
obj.set('polygon', new Parse.Polygon(coords));
|
||||||
return obj.save().then(() => {
|
return obj.save().then(() => {
|
||||||
const query = new Parse.Query(TestObject);
|
const query = new Parse.Query(TestObject);
|
||||||
return query.get(obj.id);
|
return query.get(obj.id);
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
const polygon = result.get('polygon');
|
const polygon = result.get('polygon');
|
||||||
equal(polygon.__type, 'Polygon');
|
equal(polygon instanceof Parse.Polygon, true);
|
||||||
equal(polygon.coordinates, coords);
|
equal(polygon.coordinates, coords);
|
||||||
done();
|
done();
|
||||||
}, done.fail);
|
}, done.fail);
|
||||||
@@ -42,8 +42,8 @@ describe('Parse.Polygon testing', () => {
|
|||||||
it('polygon equalTo (open/closed) path', (done) => {
|
it('polygon equalTo (open/closed) path', (done) => {
|
||||||
const openPoints = [[0,0],[0,1],[1,1],[1,0]];
|
const openPoints = [[0,0],[0,1],[1,1],[1,0]];
|
||||||
const closedPoints = [[0,0],[0,1],[1,1],[1,0],[0,0]];
|
const closedPoints = [[0,0],[0,1],[1,1],[1,0],[0,0]];
|
||||||
const openPolygon = {__type: 'Polygon', coordinates: openPoints};
|
const openPolygon = new Parse.Polygon(openPoints);
|
||||||
const closedPolygon = {__type: 'Polygon', coordinates: closedPoints};
|
const closedPolygon = new Parse.Polygon(closedPoints);
|
||||||
const obj = new TestObject();
|
const obj = new TestObject();
|
||||||
obj.set('polygon', openPolygon);
|
obj.set('polygon', openPolygon);
|
||||||
return obj.save().then(() => {
|
return obj.save().then(() => {
|
||||||
@@ -52,14 +52,14 @@ describe('Parse.Polygon testing', () => {
|
|||||||
return query.find();
|
return query.find();
|
||||||
}).then((results) => {
|
}).then((results) => {
|
||||||
const polygon = results[0].get('polygon');
|
const polygon = results[0].get('polygon');
|
||||||
equal(polygon.__type, 'Polygon');
|
equal(polygon instanceof Parse.Polygon, true);
|
||||||
equal(polygon.coordinates, closedPoints);
|
equal(polygon.coordinates, closedPoints);
|
||||||
const query = new Parse.Query(TestObject);
|
const query = new Parse.Query(TestObject);
|
||||||
query.equalTo('polygon', closedPolygon);
|
query.equalTo('polygon', closedPolygon);
|
||||||
return query.find();
|
return query.find();
|
||||||
}).then((results) => {
|
}).then((results) => {
|
||||||
const polygon = results[0].get('polygon');
|
const polygon = results[0].get('polygon');
|
||||||
equal(polygon.__type, 'Polygon');
|
equal(polygon instanceof Parse.Polygon, true);
|
||||||
equal(polygon.coordinates, closedPoints);
|
equal(polygon.coordinates, closedPoints);
|
||||||
done();
|
done();
|
||||||
}, done.fail);
|
}, done.fail);
|
||||||
@@ -67,9 +67,9 @@ describe('Parse.Polygon testing', () => {
|
|||||||
|
|
||||||
it('polygon update', (done) => {
|
it('polygon update', (done) => {
|
||||||
const oldCoords = [[0,0],[0,1],[1,1],[1,0]];
|
const oldCoords = [[0,0],[0,1],[1,1],[1,0]];
|
||||||
const oldPolygon = {__type: 'Polygon', coordinates: oldCoords};
|
const oldPolygon = new Parse.Polygon(oldCoords);
|
||||||
const newCoords = [[2,2],[2,3],[3,3],[3,2]];
|
const newCoords = [[2,2],[2,3],[3,3],[3,2]];
|
||||||
const newPolygon = {__type: 'Polygon', coordinates: newCoords};
|
const newPolygon = new Parse.Polygon(newCoords);
|
||||||
const obj = new TestObject();
|
const obj = new TestObject();
|
||||||
obj.set('polygon', oldPolygon);
|
obj.set('polygon', oldPolygon);
|
||||||
return obj.save().then(() => {
|
return obj.save().then(() => {
|
||||||
@@ -81,7 +81,7 @@ describe('Parse.Polygon testing', () => {
|
|||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
const polygon = result.get('polygon');
|
const polygon = result.get('polygon');
|
||||||
newCoords.push(newCoords[0]);
|
newCoords.push(newCoords[0]);
|
||||||
equal(polygon.__type, 'Polygon');
|
equal(polygon instanceof Parse.Polygon, true);
|
||||||
equal(polygon.coordinates, newCoords);
|
equal(polygon.coordinates, newCoords);
|
||||||
done();
|
done();
|
||||||
}, done.fail);
|
}, done.fail);
|
||||||
@@ -100,6 +100,7 @@ describe('Parse.Polygon testing', () => {
|
|||||||
it('polygon three points minimum', (done) => {
|
it('polygon three points minimum', (done) => {
|
||||||
const coords = [[0,0]];
|
const coords = [[0,0]];
|
||||||
const obj = new TestObject();
|
const obj = new TestObject();
|
||||||
|
// use raw so we test the server validates properly
|
||||||
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
|
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
|
||||||
obj.save().then(done.fail, done);
|
obj.save().then(done.fail, done);
|
||||||
});
|
});
|
||||||
@@ -107,7 +108,7 @@ describe('Parse.Polygon testing', () => {
|
|||||||
it('polygon three different points minimum', (done) => {
|
it('polygon three different points minimum', (done) => {
|
||||||
const coords = [[0,0],[0,1],[0,0]];
|
const coords = [[0,0],[0,1],[0,0]];
|
||||||
const obj = new TestObject();
|
const obj = new TestObject();
|
||||||
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
|
obj.set('polygon', new Parse.Polygon(coords));
|
||||||
obj.save().then(done.fail, done);
|
obj.save().then(done.fail, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -115,13 +116,13 @@ describe('Parse.Polygon testing', () => {
|
|||||||
const coords = [[1,1],[0,1],[0,0],[1,0]];
|
const coords = [[1,1],[0,1],[0,0],[1,0]];
|
||||||
const closed = [[1,1],[0,1],[0,0],[1,0],[1,1]];
|
const closed = [[1,1],[0,1],[0,0],[1,0],[1,1]];
|
||||||
const obj = new TestObject();
|
const obj = new TestObject();
|
||||||
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
|
obj.set('polygon', new Parse.Polygon(coords));
|
||||||
obj.save().then(() => {
|
obj.save().then(() => {
|
||||||
const query = new Parse.Query(TestObject);
|
const query = new Parse.Query(TestObject);
|
||||||
return query.get(obj.id);
|
return query.get(obj.id);
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
const polygon = result.get('polygon');
|
const polygon = result.get('polygon');
|
||||||
equal(polygon.__type, 'Polygon');
|
equal(polygon instanceof Parse.Polygon, true);
|
||||||
equal(polygon.coordinates, closed);
|
equal(polygon.coordinates, closed);
|
||||||
done();
|
done();
|
||||||
}, done.fail);
|
}, done.fail);
|
||||||
@@ -131,9 +132,9 @@ describe('Parse.Polygon testing', () => {
|
|||||||
const points1 = [[0,0],[0,1],[1,1],[1,0]];
|
const points1 = [[0,0],[0,1],[1,1],[1,0]];
|
||||||
const points2 = [[0,0],[0,2],[2,2],[2,0]];
|
const points2 = [[0,0],[0,2],[2,2],[2,0]];
|
||||||
const points3 = [[10,10],[10,15],[15,15],[15,10],[10,10]];
|
const points3 = [[10,10],[10,15],[15,15],[15,10],[10,10]];
|
||||||
const polygon1 = {__type: 'Polygon', coordinates: points1};
|
const polygon1 = new Parse.Polygon(points1);
|
||||||
const polygon2 = {__type: 'Polygon', coordinates: points2};
|
const polygon2 = new Parse.Polygon(points2);
|
||||||
const polygon3 = {__type: 'Polygon', coordinates: points3};
|
const polygon3 = new Parse.Polygon(points3);
|
||||||
const obj1 = new TestObject({location: polygon1});
|
const obj1 = new TestObject({location: polygon1});
|
||||||
const obj2 = new TestObject({location: polygon2});
|
const obj2 = new TestObject({location: polygon2});
|
||||||
const obj3 = new TestObject({location: polygon3});
|
const obj3 = new TestObject({location: polygon3});
|
||||||
@@ -161,7 +162,7 @@ describe('Parse.Polygon testing', () => {
|
|||||||
|
|
||||||
it('polygonContain invalid input', (done) => {
|
it('polygonContain invalid input', (done) => {
|
||||||
const points = [[0,0],[0,1],[1,1],[1,0]];
|
const points = [[0,0],[0,1],[1,1],[1,0]];
|
||||||
const polygon = {__type: 'Polygon', coordinates: points};
|
const polygon = new Parse.Polygon(points);
|
||||||
const obj = new TestObject({location: polygon});
|
const obj = new TestObject({location: polygon});
|
||||||
obj.save().then(() => {
|
obj.save().then(() => {
|
||||||
const where = {
|
const where = {
|
||||||
@@ -184,7 +185,7 @@ describe('Parse.Polygon testing', () => {
|
|||||||
|
|
||||||
it('polygonContain invalid geoPoint', (done) => {
|
it('polygonContain invalid geoPoint', (done) => {
|
||||||
const points = [[0,0],[0,1],[1,1],[1,0]];
|
const points = [[0,0],[0,1],[1,1],[1,0]];
|
||||||
const polygon = {__type: 'Polygon', coordinates: points};
|
const polygon = new Parse.Polygon(points);
|
||||||
const obj = new TestObject({location: polygon});
|
const obj = new TestObject({location: polygon});
|
||||||
obj.save().then(() => {
|
obj.save().then(() => {
|
||||||
const where = {
|
const where = {
|
||||||
@@ -209,6 +210,7 @@ describe('Parse.Polygon testing', () => {
|
|||||||
describe_only_db('mongo')('Parse.Polygon testing', () => {
|
describe_only_db('mongo')('Parse.Polygon testing', () => {
|
||||||
it('support 2d and 2dsphere', (done) => {
|
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,1],[1,0],[0,0]];
|
||||||
|
// testings against REST API, use raw formats
|
||||||
const polygon = {__type: 'Polygon', coordinates: coords};
|
const polygon = {__type: 'Polygon', coordinates: coords};
|
||||||
const location = {__type: 'GeoPoint', latitude:10, longitude:10};
|
const location = {__type: 'GeoPoint', latitude:10, longitude:10};
|
||||||
const databaseAdapter = new MongoStorageAdapter({ uri: mongoURI });
|
const databaseAdapter = new MongoStorageAdapter({ uri: mongoURI });
|
||||||
@@ -256,7 +258,7 @@ describe_only_db('mongo')('Parse.Polygon testing', () => {
|
|||||||
it('polygon loop is not valid', (done) => {
|
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,1]];
|
||||||
const obj = new TestObject();
|
const obj = new TestObject();
|
||||||
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
|
obj.set('polygon', new Parse.Polygon(coords));
|
||||||
obj.save().then(done.fail, done);
|
obj.save().then(done.fail, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3086,4 +3086,26 @@ describe('Parse.Query testing', () => {
|
|||||||
done();
|
done();
|
||||||
}, done.fail);
|
}, done.fail);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should not interfere with has when using select on field with undefined value #3999', (done) => {
|
||||||
|
const obj1 = new Parse.Object('TestObject');
|
||||||
|
const obj2 = new Parse.Object('OtherObject');
|
||||||
|
obj2.set('otherField', 1);
|
||||||
|
obj1.set('testPointerField', obj2);
|
||||||
|
obj1.set('shouldBe', true);
|
||||||
|
const obj3 = new Parse.Object('TestObject');
|
||||||
|
obj3.set('shouldBe', false);
|
||||||
|
Parse.Object.saveAll([obj1, obj3]).then(() => {
|
||||||
|
const query = new Parse.Query('TestObject');
|
||||||
|
query.include('testPointerField');
|
||||||
|
query.select(['testPointerField', 'testPointerField.otherField', 'shouldBe']);
|
||||||
|
return query.find();
|
||||||
|
}).then(results => {
|
||||||
|
results.forEach(result => {
|
||||||
|
equal(result.has('testPointerField'), result.get('shouldBe'));
|
||||||
|
});
|
||||||
|
done();
|
||||||
|
}
|
||||||
|
).catch(done.fail);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user