Skip to content
Closed
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
55 changes: 26 additions & 29 deletions spec/ParseGeoPoint.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,37 +39,34 @@ describe('Parse.GeoPoint testing', () => {
});
});

//

// This test is disabled, since it's extremely flaky on Travis-CI.
// Tracking issue: https://github.com/ParsePlatform/parse-server/issues/572
//
// it('geo line', (done) => {
// var line = [];
// for (var i = 0; i < 10; ++i) {
// var obj = new TestObject();
// var point = new Parse.GeoPoint(i * 4.0 - 12.0, i * 3.2 - 11.0);
// obj.set('location', point);
// obj.set('construct', 'line');
// obj.set('seq', i);
// line.push(obj);
// }
// Parse.Object.saveAll(line, {
// success: function() {
// var query = new Parse.Query(TestObject);
// var point = new Parse.GeoPoint(24, 19);
// query.equalTo('construct', 'line');
// query.withinMiles('location', point, 10000);
// query.find({
// success: function(results) {
// equal(results.length, 10);
// equal(results[0].get('seq'), 9);
// equal(results[3].get('seq'), 6);
// done();
// }
// });
// }
// });
// });
it('geo line', (done) => {
var line = [];
for (var i = 0; i < 10; ++i) {
var obj = new TestObject();
var point = new Parse.GeoPoint(i * 4.0 - 12.0, i * 3.2 - 11.0);
obj.set('location', point);
obj.set('construct', 'line');
obj.set('seq', i);
line.push(obj);
}
Parse.Object.saveAll(line).then(() => {
var query = new Parse.Query(TestObject);
var point = new Parse.GeoPoint(24, 19);
query.equalTo('construct', 'line');
query.withinMiles('location', point, 10000);
return query.find();
}).then((results) => {
equal(results.length, 10);
equal(results[0].get('seq'), 9);
equal(results[3].get('seq'), 6);
done();
}, (err) => {
fail('failed with ', err);
});
}, 10000);

it('geo max distance large', (done) => {
var objects = [];
Expand Down
2 changes: 1 addition & 1 deletion spec/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ function mockFacebook() {
function clearData() {
var promises = [];
for (var conn in DatabaseAdapter.dbConnections) {
promises.push(DatabaseAdapter.dbConnections[conn].deleteEverything());
promises.push(DatabaseAdapter.dbConnections[conn].dropDatabase());
}
return Promise.all(promises);
}
Expand Down
9 changes: 8 additions & 1 deletion src/ExportAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,14 +364,21 @@ ExportAdapter.prototype.deleteEverything = function() {
var promises = [];
for (var coll of colls) {
if (!coll.namespace.match(/\.system\./) &&
coll.collectionName.indexOf(this.collectionPrefix) === 0) {
coll.collectionName.indexOf(this.collectionPrefix) === 0) {
promises.push(coll.drop());
}
}
return Promise.all(promises);
});
};

ExportAdapter.prototype.dropDatabase = function() {
this.schemaPromise = null;
return this.connect().then(() => {
return this.db.dropDatabase();
});
};

// Finds the keys in a query. Returns a Set. REST format only
function keysForQuery(query) {
var sublist = query['$and'] || query['$or'];
Expand Down