Advancements with postgres (#2510)
* Start DB runner from tests * Connect GridstoreAdapter only when needed * removes unused package * better test errors reporting * Adds support for __op.Delete * Better test error reporting * Makes sure all tests can run without crashing * Use xdescribe to skip test suite * Removes unused dependencies * Let volatiles classes be created with PG on start * Do not fail if class dont exist * adds index.spec.js to the pg suite * Use a new config each test to prevent side effects * Enable EmailVerificationToken specs with pg * Makes sure failure output is not cut * Reduces number of ignored tests in ParseObject.spec * Inspect reconfiguration errors * Mark GlobalConfig is incompatible with PG - Problem is with nested updates (param.prop = value) * PG: Nested JSON queries and updates - Adds support for nested json and . operator queries - Adds debug support for PG adapter - Adds loglevel support in helper * Enable working specs in ParseUser * Sets default logLevel in tests to undefined * Adds File type support, retores purchaseValidation specs * Adds support for updating jsonb objects - Restores PushController tests * Proper implementation of deleteByQuery and ORs - Adds ParseInstallation spec to the test suite * xit only failing tests * Nit on ParseAPI spec * add sorting operator * properly bound order keys * reverts describe_only_db behavior * Enables passing tests * Adds basic support for relations, upsertOneObject aliased to createObject * progress on queries options * Fix ACL update related problems * Creates relation tables on class creation * Adds Relation tests * remove flaky tests * use promises instead of CB * disable flaky test * nits * Fixes on schema spec - Next thing is to implemenet geopoint and files correctly * fix failues * Basic GeoPoint support * Adds support for $nearSphere/$maxDistance geopoint queries * enable passing tests * drop tables afterEach for PG, clean up relation tables too * Better initialization/dropTables
This commit is contained in:
@@ -117,7 +117,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("relational fields", function(done) {
|
||||
it("relational fields", function(done) {
|
||||
var item = new Item();
|
||||
item.set("property", "x");
|
||||
var container = new Container();
|
||||
@@ -205,7 +205,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("createdAt doesn't change", function(done) {
|
||||
it("createdAt doesn't change", function(done) {
|
||||
var object = new TestObject({ foo: "bar" });
|
||||
object.save(null, {
|
||||
success: function() {
|
||||
@@ -269,15 +269,21 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("can set null", function(done) {
|
||||
var errored = false;
|
||||
var obj = new Parse.Object("TestObject");
|
||||
obj.set("foo", null);
|
||||
obj.save(null, {
|
||||
success: function(obj) {
|
||||
equal(obj.get("foo"), null);
|
||||
on_db('mongo', () => {
|
||||
equal(obj.get("foo"), null);
|
||||
});
|
||||
on_db('postgres', () => {
|
||||
fail('should not succeed');
|
||||
});
|
||||
done();
|
||||
},
|
||||
error: function(obj, error) {
|
||||
ok(false, error.message);
|
||||
fail('should not fail');
|
||||
done();
|
||||
}
|
||||
});
|
||||
@@ -365,7 +371,7 @@ describe('Parse.Object testing', () => {
|
||||
}).then(fail, err => next(0));
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("simple field deletion", function(done) {
|
||||
it("simple field deletion", function(done) {
|
||||
var simple = new Parse.Object("SimpleObject");
|
||||
simple.save({
|
||||
foo: "bar"
|
||||
@@ -439,7 +445,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("relation deletion", function(done) {
|
||||
it("relation deletion", function(done) {
|
||||
var simple = new Parse.Object("SimpleObject");
|
||||
var child = new Parse.Object("Child");
|
||||
simple.save({
|
||||
@@ -578,7 +584,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("addUnique", function(done) {
|
||||
it("addUnique", function(done) {
|
||||
var x1 = new Parse.Object('X');
|
||||
x1.set('stuff', [1, 2]);
|
||||
x1.save().then(() => {
|
||||
@@ -595,12 +601,17 @@ describe('Parse.Object testing', () => {
|
||||
expect(x3.get('stuff')).toEqual([1, 2, 3]);
|
||||
done();
|
||||
}, (error) => {
|
||||
fail(error);
|
||||
on_db('mongo', () => {
|
||||
jfail(error);
|
||||
});
|
||||
on_db('postgres', () => {
|
||||
expect(error.message).toEqual("Postgres does not support AddUnique operator.");
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("addUnique with object", function(done) {
|
||||
it("addUnique with object", function(done) {
|
||||
var x1 = new Parse.Object('X');
|
||||
x1.set('stuff', [ 1, {'hello': 'world'}, {'foo': 'bar'}]);
|
||||
x1.save().then(() => {
|
||||
@@ -617,12 +628,17 @@ describe('Parse.Object testing', () => {
|
||||
expect(x3.get('stuff')).toEqual([1, {'hello': 'world'}, {'foo': 'bar'}, {'bar': 'baz'}]);
|
||||
done();
|
||||
}, (error) => {
|
||||
fail(error);
|
||||
on_db('mongo', () => {
|
||||
jfail(error);
|
||||
});
|
||||
on_db('postgres', () => {
|
||||
expect(error.message).toEqual("Postgres does not support AddUnique operator.");
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("removes with object", function(done) {
|
||||
it("removes with object", function(done) {
|
||||
var x1 = new Parse.Object('X');
|
||||
x1.set('stuff', [ 1, {'hello': 'world'}, {'foo': 'bar'}]);
|
||||
x1.save().then(() => {
|
||||
@@ -638,7 +654,12 @@ describe('Parse.Object testing', () => {
|
||||
expect(x3.get('stuff')).toEqual([1, {'foo': 'bar'}]);
|
||||
done();
|
||||
}, (error) => {
|
||||
fail(error);
|
||||
on_db('mongo', () => {
|
||||
jfail(error);
|
||||
});
|
||||
on_db('postgres', () => {
|
||||
expect(error.message).toEqual("Postgres does not support Remove operator.");
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -668,7 +689,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("dirty keys", function(done) {
|
||||
it("dirty keys", function(done) {
|
||||
var object = new Parse.Object("TestObject");
|
||||
object.set("gogo", "good");
|
||||
object.set("sito", "sexy");
|
||||
@@ -763,7 +784,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("old attribute unset then unset", function(done) {
|
||||
it("old attribute unset then unset", function(done) {
|
||||
var TestObject = Parse.Object.extend("TestObject");
|
||||
var obj = new TestObject();
|
||||
obj.set("x", 3);
|
||||
@@ -832,7 +853,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("old attribute unset then clear", function(done) {
|
||||
it("old attribute unset then clear", function(done) {
|
||||
var TestObject = Parse.Object.extend("TestObject");
|
||||
var obj = new TestObject();
|
||||
obj.set("x", 3);
|
||||
@@ -901,7 +922,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("old attribute clear then unset", function(done) {
|
||||
it("old attribute clear then unset", function(done) {
|
||||
var TestObject = Parse.Object.extend("TestObject");
|
||||
var obj = new TestObject();
|
||||
obj.set("x", 3);
|
||||
@@ -970,7 +991,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("old attribute clear then clear", function(done) {
|
||||
it("old attribute clear then clear", function(done) {
|
||||
var TestObject = Parse.Object.extend("TestObject");
|
||||
var obj = new TestObject();
|
||||
obj.set("x", 3);
|
||||
@@ -1039,7 +1060,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("saving children in an array", function(done) {
|
||||
it("saving children in an array", function(done) {
|
||||
var Parent = Parse.Object.extend("Parent");
|
||||
var Child = Parse.Object.extend("Child");
|
||||
|
||||
@@ -1342,7 +1363,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("fetchAll", function(done) {
|
||||
it("fetchAll", function(done) {
|
||||
var numItems = 11;
|
||||
var container = new Container();
|
||||
var items = [];
|
||||
@@ -1389,7 +1410,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("fetchAll updates dates", function(done) {
|
||||
it("fetchAll updates dates", function(done) {
|
||||
var updatedObject;
|
||||
var object = new TestObject();
|
||||
object.set("x", 7);
|
||||
@@ -1409,7 +1430,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("fetchAll backbone-style callbacks", function(done) {
|
||||
it("fetchAll backbone-style callbacks", function(done) {
|
||||
var numItems = 11;
|
||||
var container = new Container();
|
||||
var items = [];
|
||||
@@ -1478,7 +1499,7 @@ describe('Parse.Object testing', () => {
|
||||
expectError(Parse.Error.MISSING_OBJECT_ID, done));
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("fetchAll error on deleted object", function(done) {
|
||||
it("fetchAll error on deleted object", function(done) {
|
||||
var numItems = 11;
|
||||
var container = new Container();
|
||||
var subContainer = new Container();
|
||||
@@ -1536,7 +1557,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("fetchAllIfNeeded", function(done) {
|
||||
it("fetchAllIfNeeded", function(done) {
|
||||
var numItems = 11;
|
||||
var container = new Container();
|
||||
var items = [];
|
||||
@@ -1574,7 +1595,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])("fetchAllIfNeeded backbone-style callbacks", function(done) {
|
||||
it("fetchAllIfNeeded backbone-style callbacks", function(done) {
|
||||
var numItems = 11;
|
||||
var container = new Container();
|
||||
var items = [];
|
||||
@@ -1778,7 +1799,7 @@ describe('Parse.Object testing', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])('dictionary fetched pointers do not lose data on fetch', (done) => {
|
||||
it('dictionary fetched pointers do not lose data on fetch', (done) => {
|
||||
var parent = new Parse.Object('Parent');
|
||||
var dict = {};
|
||||
for (var i = 0; i < 5; i++) {
|
||||
@@ -1832,13 +1853,13 @@ describe('Parse.Object testing', () => {
|
||||
expect(foo["_more"]["_nested"]).toEqual("key");
|
||||
done();
|
||||
}).fail( err => {
|
||||
console.error(err);
|
||||
jfail(err);
|
||||
fail("should not fail");
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])('should have undefined includes when object is missing', (done) => {
|
||||
it('should have undefined includes when object is missing', (done) => {
|
||||
let obj1 = new Parse.Object("AnObject");
|
||||
let obj2 = new Parse.Object("AnObject");
|
||||
|
||||
@@ -1852,13 +1873,19 @@ describe('Parse.Object testing', () => {
|
||||
return query.find();
|
||||
}).then((res) => {
|
||||
expect(res.length).toBe(1);
|
||||
expect(res[0].get("obj")).toBe(undefined);
|
||||
if (res[0]) {
|
||||
expect(res[0].get("obj")).toBe(undefined);
|
||||
}
|
||||
let query = new Parse.Query("AnObject");
|
||||
return query.find();
|
||||
}).then((res) => {
|
||||
expect(res.length).toBe(1);
|
||||
expect(res[0].get("obj")).not.toBe(undefined);
|
||||
return res[0].get("obj").fetch();
|
||||
if (res[0]) {
|
||||
expect(res[0].get("obj")).not.toBe(undefined);
|
||||
return res[0].get("obj").fetch();
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
}).then(() => {
|
||||
fail("Should not fetch a deleted object");
|
||||
}, (err) => {
|
||||
@@ -1867,7 +1894,7 @@ describe('Parse.Object testing', () => {
|
||||
})
|
||||
});
|
||||
|
||||
it_exclude_dbs(['postgres'])('should have undefined includes when object is missing on deeper path', (done) => {
|
||||
it('should have undefined includes when object is missing on deeper path', (done) => {
|
||||
let obj1 = new Parse.Object("AnObject");
|
||||
let obj2 = new Parse.Object("AnObject");
|
||||
let obj3 = new Parse.Object("AnObject");
|
||||
@@ -1884,6 +1911,9 @@ describe('Parse.Object testing', () => {
|
||||
expect(res.get("obj")).not.toBe(undefined);
|
||||
expect(res.get("obj").get("obj")).toBe(undefined);
|
||||
done();
|
||||
});
|
||||
}).catch(err => {
|
||||
jfail(err);
|
||||
done();
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user