committed by
Florent Vilmart
parent
d149d16fce
commit
a380fcf2c7
@@ -26,6 +26,25 @@ describe('Parse.GeoPoint testing', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('update geopoint', (done) => {
|
||||||
|
const oldPoint = new Parse.GeoPoint(44.0, -11.0);
|
||||||
|
const newPoint = new Parse.GeoPoint(24.0, 19.0);
|
||||||
|
const obj = new TestObject();
|
||||||
|
obj.set('location', oldPoint);
|
||||||
|
obj.save().then(() => {
|
||||||
|
obj.set('location', newPoint);
|
||||||
|
return obj.save();
|
||||||
|
}).then(() => {
|
||||||
|
var query = new Parse.Query(TestObject);
|
||||||
|
return query.get(obj.id);
|
||||||
|
}).then((result) => {
|
||||||
|
const point = result.get('location');
|
||||||
|
equal(point.latitude, newPoint.latitude);
|
||||||
|
equal(point.longitude, newPoint.longitude);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('has the correct __type field in the json response', done => {
|
it('has the correct __type field in the json response', done => {
|
||||||
var point = new Parse.GeoPoint(44.0, -11.0);
|
var point = new Parse.GeoPoint(44.0, -11.0);
|
||||||
var obj = new TestObject();
|
var obj = new TestObject();
|
||||||
|
|||||||
@@ -920,7 +920,7 @@ export class PostgresStorageAdapter {
|
|||||||
index += 2;
|
index += 2;
|
||||||
} else if (fieldValue.__type === 'GeoPoint') {
|
} else if (fieldValue.__type === 'GeoPoint') {
|
||||||
updatePatterns.push(`$${index}:name = POINT($${index + 1}, $${index + 2})`);
|
updatePatterns.push(`$${index}:name = POINT($${index + 1}, $${index + 2})`);
|
||||||
values.push(fieldName, fieldValue.latitude, fieldValue.longitude);
|
values.push(fieldName, fieldValue.longitude, fieldValue.latitude);
|
||||||
index += 3;
|
index += 3;
|
||||||
} else if (fieldValue.__type === 'Relation') {
|
} else if (fieldValue.__type === 'Relation') {
|
||||||
// noop
|
// noop
|
||||||
|
|||||||
Reference in New Issue
Block a user