Postgres: Operations, Hooks, OAuth login, Files support (#2528)
* Adds files related tests through fs-adapter with PG * Schema deletions implementations * Adds Hooks spec * Fix test * Adds support for containsAll (numbers and strings) * Better support for deleteFields and deleteClass * Recursive JSON update for authData * Adds node_modules to travis cache * Disable temporarily to make tests pass * Adds _perishable_token support for _User class * ignore when a table creation fails at init (table exists) * Adds support for AddUnique and Remove * PG 9.4 compatible functions * Re-enable tests * nit * Better handling of schema creation race
This commit is contained in:
@@ -591,14 +591,19 @@ describe('Parse.Object testing', () => {
|
||||
var objectId = x1.id;
|
||||
var x2 = new Parse.Object('X', {objectId: objectId});
|
||||
x2.addUnique('stuff', 2);
|
||||
x2.addUnique('stuff', 3);
|
||||
expect(x2.get('stuff')).toEqual([2, 3]);
|
||||
x2.addUnique('stuff', 4);
|
||||
expect(x2.get('stuff')).toEqual([2, 4]);
|
||||
return x2.save();
|
||||
}).then(() => {
|
||||
var query = new Parse.Query('X');
|
||||
return query.get(x1.id);
|
||||
}).then((x3) => {
|
||||
expect(x3.get('stuff')).toEqual([1, 2, 3]);
|
||||
let stuff = x3.get('stuff');
|
||||
let expected = [1, 2, 4];
|
||||
expect(stuff.length).toBe(expected.length);
|
||||
for (var i of stuff) {
|
||||
expect(expected.indexOf(i) >= 0).toBe(true);
|
||||
}
|
||||
done();
|
||||
}, (error) => {
|
||||
on_db('mongo', () => {
|
||||
@@ -625,15 +630,21 @@ describe('Parse.Object testing', () => {
|
||||
var query = new Parse.Query('X');
|
||||
return query.get(x1.id);
|
||||
}).then((x3) => {
|
||||
expect(x3.get('stuff')).toEqual([1, {'hello': 'world'}, {'foo': 'bar'}, {'bar': 'baz'}]);
|
||||
let stuff = x3.get('stuff');
|
||||
let target = [1, {'hello': 'world'}, {'foo': 'bar'}, {'bar': 'baz'}];
|
||||
expect(stuff.length).toEqual(target.length);
|
||||
let found = 0;
|
||||
for (let thing in target) {
|
||||
for (let st in stuff) {
|
||||
if (st == thing) {
|
||||
found++;
|
||||
}
|
||||
}
|
||||
}
|
||||
expect(found).toBe(target.length);
|
||||
done();
|
||||
}, (error) => {
|
||||
on_db('mongo', () => {
|
||||
jfail(error);
|
||||
});
|
||||
on_db('postgres', () => {
|
||||
expect(error.message).toEqual("Postgres does not support AddUnique operator.");
|
||||
});
|
||||
jfail(error);
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -654,6 +665,7 @@ describe('Parse.Object testing', () => {
|
||||
expect(x3.get('stuff')).toEqual([1, {'foo': 'bar'}]);
|
||||
done();
|
||||
}, (error) => {
|
||||
console.error(error);
|
||||
on_db('mongo', () => {
|
||||
jfail(error);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user