Updates JS SDK to 2.1.0 (#5043)

This commit is contained in:
Florent Vilmart
2018-09-08 20:05:32 -04:00
committed by GitHub
parent a3d6d2498c
commit 576779b69b
9 changed files with 2570 additions and 2581 deletions

5053
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,7 @@
"lru-cache": "4.1.3", "lru-cache": "4.1.3",
"mime": "2.3.1", "mime": "2.3.1",
"mongodb": "3.1.4", "mongodb": "3.1.4",
"parse": "2.0.2", "parse": "2.1.0",
"pg-promise": "8.4.6", "pg-promise": "8.4.6",
"redis": "2.8.0", "redis": "2.8.0",
"request": "2.88.0", "request": "2.88.0",

View File

@@ -727,7 +727,7 @@ describe('Cloud Code', () => {
.then( .then(
function() { function() {
const objAgain = new Parse.Object('BeforeDeleteTest', obj.id); const objAgain = new Parse.Object('BeforeDeleteTest', obj.id);
return objAgain.fetch().then(fail, done); return objAgain.fetch().then(fail, () => done());
}, },
function(error) { function(error) {
fail(error); fail(error);

View File

@@ -209,6 +209,8 @@ describe('Cloud Code Logger', () => {
expect(log[1]).toMatch( expect(log[1]).toMatch(
/Failed running cloud function aFunction for user [^ ]* with:\n {2}Input: {"foo":"bar"}\n {2}Error:/ /Failed running cloud function aFunction for user [^ ]* with:\n {2}Input: {"foo":"bar"}\n {2}Error:/
); );
const errorString = JSON.stringify(new Parse.Error(141, 'it failed!'));
expect(log[1].indexOf(errorString)).toBeGreaterThan(0);
done(); done();
}) })
.catch(done.fail); .catch(done.fail);

View File

@@ -91,7 +91,7 @@ describe('Parse.Object testing', () => {
t.save().then(function() { t.save().then(function() {
t.destroy().then(function() { t.destroy().then(function() {
const t2 = new TestObject({ objectId: t.id }); const t2 = new TestObject({ objectId: t.id });
t2.fetch().then(fail, done); t2.fetch().then(fail, () => done());
}); });
}); });
}); });
@@ -298,7 +298,7 @@ describe('Parse.Object testing', () => {
!item.set({ 'foo^bar': 'baz' }), !item.set({ 'foo^bar': 'baz' }),
'Item should not be updated with invalid key.' 'Item should not be updated with invalid key.'
); );
item.save({ 'foo^bar': 'baz' }).then(fail, done); item.save({ 'foo^bar': 'baz' }).then(fail, () => done());
}); });
it('invalid __type', function(done) { it('invalid __type', function(done) {
@@ -1189,7 +1189,7 @@ describe('Parse.Object testing', () => {
ok(!obj.dirty(), 'The object should not be dirty'); ok(!obj.dirty(), 'The object should not be dirty');
ok(obj.get('aDate')); ok(obj.get('aDate'));
}) })
.finally(function() { .then(function() {
restController.request = r; restController.request = r;
done(); done();
}); });
@@ -1216,7 +1216,7 @@ describe('Parse.Object testing', () => {
ok(obj.dirty(), 'The object should be dirty'); ok(obj.dirty(), 'The object should be dirty');
equal(now, obj.get('aDate')); equal(now, obj.get('aDate'));
}) })
.finally(function() { .then(function() {
restController.request = r; restController.request = r;
done(); done();
}); });

View File

@@ -115,7 +115,7 @@ describe('Parse.Polygon testing', () => {
const query = new Parse.Query(TestObject); const query = new Parse.Query(TestObject);
return query.get(obj.id); return query.get(obj.id);
}) })
.then(done.fail, done); .then(done.fail, () => done());
}); });
it('polygon three points minimum', done => { it('polygon three points minimum', done => {
@@ -123,14 +123,14 @@ describe('Parse.Polygon testing', () => {
const obj = new TestObject(); const obj = new TestObject();
// use raw so we test the server validates properly // use raw so we test the server validates properly
obj.set('polygon', { __type: 'Polygon', coordinates: coords }); obj.set('polygon', { __type: 'Polygon', coordinates: coords });
obj.save().then(done.fail, done); obj.save().then(done.fail, () => done());
}); });
it('polygon three different points minimum', done => { it('polygon three different points minimum', done => {
const coords = [[0, 0], [0, 1], [0, 0]]; const coords = [[0, 0], [0, 1], [0, 0]];
const obj = new TestObject(); const obj = new TestObject();
obj.set('polygon', new Parse.Polygon(coords)); obj.set('polygon', new Parse.Polygon(coords));
obj.save().then(done.fail, done); obj.save().then(done.fail, () => done());
}); });
it('polygon counterclockwise', done => { it('polygon counterclockwise', done => {
@@ -398,6 +398,6 @@ describe_only_db('mongo')('Parse.Polygon testing', () => {
const coords = [[0, 0], [0, 1], [1, 0], [1, 1]]; const coords = [[0, 0], [0, 1], [1, 0], [1, 1]];
const obj = new TestObject(); const obj = new TestObject();
obj.set('polygon', new Parse.Polygon(coords)); obj.set('polygon', new Parse.Polygon(coords));
obj.save().then(done.fail, done); obj.save().then(done.fail, () => done());
}); });
}); });

View File

@@ -1360,7 +1360,7 @@ describe('Parse.Query testing', () => {
.find() .find()
.then(done.fail) .then(done.fail)
.catch(error => expect(error.code).toBe(Parse.Error.INVALID_KEY_NAME)) .catch(error => expect(error.code).toBe(Parse.Error.INVALID_KEY_NAME))
.finally(done); .then(done);
}); });
it('get', function(done) { it('get', function(done) {
@@ -1387,7 +1387,7 @@ describe('Parse.Query testing', () => {
) { ) {
ok(items[0]); ok(items[0]);
const query = new Parse.Query(TestObject); const query = new Parse.Query(TestObject);
query.get(undefined).then(fail, done); query.get(undefined).then(fail, () => done());
}); });
}); });
@@ -1453,7 +1453,7 @@ describe('Parse.Query testing', () => {
.first() .first()
.then(done.fail) .then(done.fail)
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME)) .catch(e => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME))
.finally(done); .then(done);
}); });
const Container = Parse.Object.extend({ const Container = Parse.Object.extend({
@@ -1821,7 +1821,7 @@ describe('Parse.Query testing', () => {
.find() .find()
.then(done.fail) .then(done.fail)
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME)) .catch(e => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME))
.finally(done); .then(done);
}); });
}); });
@@ -2044,7 +2044,7 @@ describe('Parse.Query testing', () => {
.find() .find()
.then(done.fail) .then(done.fail)
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_QUERY)) .catch(e => expect(e.code).toBe(Parse.Error.INVALID_QUERY))
.finally(done); .then(done);
}); });
it('Use a regex that requires all modifiers', function(done) { it('Use a regex that requires all modifiers', function(done) {
@@ -4235,7 +4235,7 @@ describe('Parse.Query testing', () => {
obj1 obj1
.save({ useMasterKey: true }) .save({ useMasterKey: true })
.then(() => q.find({ useMasterKey: true })) .then(() => q.find({ useMasterKey: true }))
.then(done.fail, done); .then(done.fail, () => done());
}); });
it_only_db('mongo')( it_only_db('mongo')(
@@ -4252,7 +4252,7 @@ describe('Parse.Query testing', () => {
obj1 obj1
.save({ useMasterKey: true }) .save({ useMasterKey: true })
.then(() => q.find({ useMasterKey: true })) .then(() => q.find({ useMasterKey: true }))
.then(done.fail, done); .then(done.fail, () => done());
} }
); );
@@ -4399,7 +4399,7 @@ describe('Parse.Query testing', () => {
q.find() q.find()
.then(done.fail) .then(done.fail)
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_JSON)) .catch(e => expect(e.code).toBe(Parse.Error.INVALID_JSON))
.finally(done); .then(done);
}); });
it('withJSON with geoWithin.centerSphere fails with invalid distance', done => { it('withJSON with geoWithin.centerSphere fails with invalid distance', done => {
@@ -4414,7 +4414,7 @@ describe('Parse.Query testing', () => {
q.find() q.find()
.then(done.fail) .then(done.fail)
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_JSON)) .catch(e => expect(e.code).toBe(Parse.Error.INVALID_JSON))
.finally(() => done()); .then(done);
}); });
it('withJSON with geoWithin.centerSphere fails with invalid coordinate', done => { it('withJSON with geoWithin.centerSphere fails with invalid coordinate', done => {
@@ -4428,7 +4428,7 @@ describe('Parse.Query testing', () => {
q.withJSON(jsonQ); q.withJSON(jsonQ);
q.find() q.find()
.then(done.fail) .then(done.fail)
.catch(done); .catch(() => done());
}); });
it('withJSON with geoWithin.centerSphere fails with invalid geo point', done => { it('withJSON with geoWithin.centerSphere fails with invalid geo point', done => {
@@ -4442,6 +4442,6 @@ describe('Parse.Query testing', () => {
q.withJSON(jsonQ); q.withJSON(jsonQ);
q.find() q.find()
.then(done.fail) .then(done.fail)
.catch(done); .catch(() => done());
}); });
}); });

View File

@@ -1225,10 +1225,10 @@ describe('Parse.User testing', () => {
}); });
it('user authData should be available in cloudcode (#2342)', async done => { it('user authData should be available in cloudcode (#2342)', async done => {
Parse.Cloud.define('checkLogin', (req, res) => { Parse.Cloud.define('checkLogin', req => {
expect(req.user).not.toBeUndefined(); expect(req.user).not.toBeUndefined();
expect(Parse.FacebookUtils.isLinked(req.user)).toBe(true); expect(Parse.FacebookUtils.isLinked(req.user)).toBe(true);
res.success(); return 'ok';
}); });
const provider = getMockFacebookProvider(); const provider = getMockFacebookProvider();

View File

@@ -88,22 +88,18 @@ describe('SchemaController', () => {
aRelation: { __type: 'Relation', className: 'Stuff' }, aRelation: { __type: 'Relation', className: 'Stuff' },
}); });
}) })
.then( .then(schema => {
schema => { return schema
return schema .validateObject('Stuff', {
.validateObject('Stuff', { aRelation: { __type: 'Pointer', className: 'Stuff' },
aRelation: { __type: 'Pointer', className: 'Stuff' }, })
}) .then(
.then(() => { () => {
fail('expected invalidity'); done.fail('expected invalidity');
done(); },
}, done); () => done()
}, );
err => { }, done.fail);
fail(err);
done();
}
);
}); });
it('rejects inconsistent types', done => { it('rejects inconsistent types', done => {
@@ -115,10 +111,13 @@ describe('SchemaController', () => {
.then(schema => { .then(schema => {
return schema.validateObject('Stuff', { bacon: 'z' }); return schema.validateObject('Stuff', { bacon: 'z' });
}) })
.then(() => { .then(
fail('expected invalidity'); () => {
done(); fail('expected invalidity');
}, done); done();
},
() => done()
);
}); });
it('updates when new fields are added', done => { it('updates when new fields are added', done => {
@@ -133,10 +132,13 @@ describe('SchemaController', () => {
.then(schema => { .then(schema => {
return schema.validateObject('Stuff', { sausage: 'ate' }); return schema.validateObject('Stuff', { sausage: 'ate' });
}) })
.then(() => { .then(
fail('expected invalidity'); () => {
done(); fail('expected invalidity');
}, done); done();
},
() => done()
);
}); });
it('class-level permissions test find', done => { it('class-level permissions test find', done => {