diff --git a/spec/ParseGeoPoint.spec.js b/spec/ParseGeoPoint.spec.js index 66613603eb..9f2bfdbd8c 100644 --- a/spec/ParseGeoPoint.spec.js +++ b/spec/ParseGeoPoint.spec.js @@ -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 = []; diff --git a/spec/helper.js b/spec/helper.js index 9ad56d3d16..02ce997ba9 100644 --- a/spec/helper.js +++ b/spec/helper.js @@ -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); } diff --git a/src/ExportAdapter.js b/src/ExportAdapter.js index 821c69cdca..73a0920b32 100644 --- a/src/ExportAdapter.js +++ b/src/ExportAdapter.js @@ -364,7 +364,7 @@ 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()); } } @@ -372,6 +372,13 @@ ExportAdapter.prototype.deleteEverything = function() { }); }; +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'];