Skip to content

Commit 3cd7f7d

Browse files
committed
Add geo point in subobject and array end-to-end tests.
1 parent 0acd8c6 commit 3cd7f7d

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

spec/ParseGeoPoint.spec.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,4 +287,47 @@ describe('Parse.GeoPoint testing', () => {
287287
done();
288288
});
289289
});
290+
291+
it('supports a sub-object with a geo point', done => {
292+
var point = new Parse.GeoPoint(44.0, -11.0);
293+
var obj = new TestObject();
294+
obj.set('subobject', { location: point });
295+
obj.save(null, {
296+
success: function() {
297+
var query = new Parse.Query(TestObject);
298+
query.find({
299+
success: function(results) {
300+
equal(results.length, 1);
301+
var pointAgain = results[0].get('subobject')['location'];
302+
ok(pointAgain);
303+
equal(pointAgain.latitude, 44.0);
304+
equal(pointAgain.longitude, -11.0);
305+
done();
306+
}
307+
});
308+
}
309+
});
310+
});
311+
312+
it('supports array of geo points', done => {
313+
var point1 = new Parse.GeoPoint(44.0, -11.0);
314+
var point2 = new Parse.GeoPoint(22.0, -55.0);
315+
var obj = new TestObject();
316+
obj.set('locations', [ point1, point2 ]);
317+
obj.save(null, {
318+
success: function() {
319+
var query = new Parse.Query(TestObject);
320+
query.find({
321+
success: function(results) {
322+
equal(results.length, 1);
323+
var locations = results[0].get('locations');
324+
expect(locations.length).toEqual(2);
325+
expect(locations[0]).toEqual(point1);
326+
expect(locations[1]).toEqual(point2);
327+
done();
328+
}
329+
});
330+
}
331+
});
332+
});
290333
});

0 commit comments

Comments
 (0)