Skip to content

Bumps parse sdk 1.10.1 #4274

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"mime": "1.4.0",
"mongodb": "2.2.31",
"multer": "1.3.0",
"parse": "1.10.0",
"parse": "1.10.1",
"parse-server-fs-adapter": "1.0.1",
"parse-server-push-adapter": "2.0.0",
"parse-server-s3-adapter": "1.2.0",
Expand Down
42 changes: 22 additions & 20 deletions spec/ParsePolygon.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ describe('Parse.Polygon testing', () => {
const coords = [[0,0],[0,1],[1,1],[1,0]];
const closed = [[0,0],[0,1],[1,1],[1,0],[0,0]];
const obj = new TestObject();
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
obj.set('polygon', new Parse.Polygon(coords));
return obj.save().then(() => {
const query = new Parse.Query(TestObject);
return query.get(obj.id);
}).then((result) => {
const polygon = result.get('polygon');
equal(polygon.__type, 'Polygon');
equal(polygon instanceof Parse.Polygon, true);
equal(polygon.coordinates, closed);
done();
}, done.fail);
Expand All @@ -27,13 +27,13 @@ describe('Parse.Polygon testing', () => {
it('polygon save closed path', (done) => {
const coords = [[0,0],[0,1],[1,1],[1,0],[0,0]];
const obj = new TestObject();
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
obj.set('polygon', new Parse.Polygon(coords));
return obj.save().then(() => {
const query = new Parse.Query(TestObject);
return query.get(obj.id);
}).then((result) => {
const polygon = result.get('polygon');
equal(polygon.__type, 'Polygon');
equal(polygon instanceof Parse.Polygon, true);
equal(polygon.coordinates, coords);
done();
}, done.fail);
Expand All @@ -42,8 +42,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 openPolygon = {__type: 'Polygon', coordinates: openPoints};
const closedPolygon = {__type: 'Polygon', coordinates: closedPoints};
const openPolygon = new Parse.Polygon(openPoints);
const closedPolygon = new Parse.Polygon(closedPoints);
const obj = new TestObject();
obj.set('polygon', openPolygon);
return obj.save().then(() => {
Expand All @@ -52,24 +52,24 @@ describe('Parse.Polygon testing', () => {
return query.find();
}).then((results) => {
const polygon = results[0].get('polygon');
equal(polygon.__type, 'Polygon');
equal(polygon instanceof Parse.Polygon, true);
equal(polygon.coordinates, closedPoints);
const query = new Parse.Query(TestObject);
query.equalTo('polygon', closedPolygon);
return query.find();
}).then((results) => {
const polygon = results[0].get('polygon');
equal(polygon.__type, 'Polygon');
equal(polygon instanceof Parse.Polygon, true);
equal(polygon.coordinates, closedPoints);
done();
}, done.fail);
});

it('polygon update', (done) => {
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 newPolygon = {__type: 'Polygon', coordinates: newCoords};
const newPolygon = new Parse.Polygon(newCoords);
const obj = new TestObject();
obj.set('polygon', oldPolygon);
return obj.save().then(() => {
Expand All @@ -81,7 +81,7 @@ describe('Parse.Polygon testing', () => {
}).then((result) => {
const polygon = result.get('polygon');
newCoords.push(newCoords[0]);
equal(polygon.__type, 'Polygon');
equal(polygon instanceof Parse.Polygon, true);
equal(polygon.coordinates, newCoords);
done();
}, done.fail);
Expand All @@ -100,28 +100,29 @@ describe('Parse.Polygon testing', () => {
it('polygon three points minimum', (done) => {
const coords = [[0,0]];
const obj = new TestObject();
// use raw so we test the server validates properly
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
obj.save().then(done.fail, done);
});

it('polygon three different points minimum', (done) => {
const coords = [[0,0],[0,1],[0,0]];
const obj = new TestObject();
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
obj.set('polygon', new Parse.Polygon(coords));
obj.save().then(done.fail, done);
});

it('polygon counterclockwise', (done) => {
const coords = [[1,1],[0,1],[0,0],[1,0]];
const closed = [[1,1],[0,1],[0,0],[1,0],[1,1]];
const obj = new TestObject();
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
obj.set('polygon', new Parse.Polygon(coords));
obj.save().then(() => {
const query = new Parse.Query(TestObject);
return query.get(obj.id);
}).then((result) => {
const polygon = result.get('polygon');
equal(polygon.__type, 'Polygon');
equal(polygon instanceof Parse.Polygon, true);
equal(polygon.coordinates, closed);
done();
}, done.fail);
Expand All @@ -131,9 +132,9 @@ describe('Parse.Polygon testing', () => {
const points1 = [[0,0],[0,1],[1,1],[1,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 = {__type: 'Polygon', coordinates: points1};
const polygon2 = {__type: 'Polygon', coordinates: points2};
const polygon3 = {__type: 'Polygon', coordinates: points3};
const polygon1 = new Parse.Polygon(points1);
const polygon2 = new Parse.Polygon(points2);
const polygon3 = new Parse.Polygon(points3);
const obj1 = new TestObject({location: polygon1});
const obj2 = new TestObject({location: polygon2});
const obj3 = new TestObject({location: polygon3});
Expand Down Expand Up @@ -161,7 +162,7 @@ describe('Parse.Polygon testing', () => {

it('polygonContain invalid input', (done) => {
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});
obj.save().then(() => {
const where = {
Expand All @@ -184,7 +185,7 @@ describe('Parse.Polygon testing', () => {

it('polygonContain invalid geoPoint', (done) => {
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});
obj.save().then(() => {
const where = {
Expand All @@ -209,6 +210,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]];
// testings against REST API, use raw formats
const polygon = {__type: 'Polygon', coordinates: coords};
const location = {__type: 'GeoPoint', latitude:10, longitude:10};
const databaseAdapter = new MongoStorageAdapter({ uri: mongoURI });
Expand Down Expand Up @@ -256,7 +258,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 obj = new TestObject();
obj.set('polygon', {__type: 'Polygon', coordinates: coords});
obj.set('polygon', new Parse.Polygon(coords));
obj.save().then(done.fail, done);
});
});
22 changes: 22 additions & 0 deletions spec/ParseQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3086,4 +3086,26 @@ describe('Parse.Query testing', () => {
done();
}, 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);
});
});