Updates JS SDK to 2.1.0 (#5043)
This commit is contained in:
@@ -727,7 +727,7 @@ describe('Cloud Code', () => {
|
||||
.then(
|
||||
function() {
|
||||
const objAgain = new Parse.Object('BeforeDeleteTest', obj.id);
|
||||
return objAgain.fetch().then(fail, done);
|
||||
return objAgain.fetch().then(fail, () => done());
|
||||
},
|
||||
function(error) {
|
||||
fail(error);
|
||||
|
||||
@@ -209,6 +209,8 @@ describe('Cloud Code Logger', () => {
|
||||
expect(log[1]).toMatch(
|
||||
/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();
|
||||
})
|
||||
.catch(done.fail);
|
||||
|
||||
@@ -91,7 +91,7 @@ describe('Parse.Object testing', () => {
|
||||
t.save().then(function() {
|
||||
t.destroy().then(function() {
|
||||
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 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) {
|
||||
@@ -1189,7 +1189,7 @@ describe('Parse.Object testing', () => {
|
||||
ok(!obj.dirty(), 'The object should not be dirty');
|
||||
ok(obj.get('aDate'));
|
||||
})
|
||||
.finally(function() {
|
||||
.then(function() {
|
||||
restController.request = r;
|
||||
done();
|
||||
});
|
||||
@@ -1216,7 +1216,7 @@ describe('Parse.Object testing', () => {
|
||||
ok(obj.dirty(), 'The object should be dirty');
|
||||
equal(now, obj.get('aDate'));
|
||||
})
|
||||
.finally(function() {
|
||||
.then(function() {
|
||||
restController.request = r;
|
||||
done();
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@ describe('Parse.Polygon testing', () => {
|
||||
const query = new Parse.Query(TestObject);
|
||||
return query.get(obj.id);
|
||||
})
|
||||
.then(done.fail, done);
|
||||
.then(done.fail, () => done());
|
||||
});
|
||||
|
||||
it('polygon three points minimum', done => {
|
||||
@@ -123,14 +123,14 @@ describe('Parse.Polygon testing', () => {
|
||||
const obj = new TestObject();
|
||||
// use raw so we test the server validates properly
|
||||
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 => {
|
||||
const coords = [[0, 0], [0, 1], [0, 0]];
|
||||
const obj = new TestObject();
|
||||
obj.set('polygon', new Parse.Polygon(coords));
|
||||
obj.save().then(done.fail, done);
|
||||
obj.save().then(done.fail, () => 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 obj = new TestObject();
|
||||
obj.set('polygon', new Parse.Polygon(coords));
|
||||
obj.save().then(done.fail, done);
|
||||
obj.save().then(done.fail, () => done());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1360,7 +1360,7 @@ describe('Parse.Query testing', () => {
|
||||
.find()
|
||||
.then(done.fail)
|
||||
.catch(error => expect(error.code).toBe(Parse.Error.INVALID_KEY_NAME))
|
||||
.finally(done);
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('get', function(done) {
|
||||
@@ -1387,7 +1387,7 @@ describe('Parse.Query testing', () => {
|
||||
) {
|
||||
ok(items[0]);
|
||||
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()
|
||||
.then(done.fail)
|
||||
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME))
|
||||
.finally(done);
|
||||
.then(done);
|
||||
});
|
||||
|
||||
const Container = Parse.Object.extend({
|
||||
@@ -1821,7 +1821,7 @@ describe('Parse.Query testing', () => {
|
||||
.find()
|
||||
.then(done.fail)
|
||||
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME))
|
||||
.finally(done);
|
||||
.then(done);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2044,7 +2044,7 @@ describe('Parse.Query testing', () => {
|
||||
.find()
|
||||
.then(done.fail)
|
||||
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_QUERY))
|
||||
.finally(done);
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('Use a regex that requires all modifiers', function(done) {
|
||||
@@ -4235,7 +4235,7 @@ describe('Parse.Query testing', () => {
|
||||
obj1
|
||||
.save({ useMasterKey: true })
|
||||
.then(() => q.find({ useMasterKey: true }))
|
||||
.then(done.fail, done);
|
||||
.then(done.fail, () => done());
|
||||
});
|
||||
|
||||
it_only_db('mongo')(
|
||||
@@ -4252,7 +4252,7 @@ describe('Parse.Query testing', () => {
|
||||
obj1
|
||||
.save({ 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()
|
||||
.then(done.fail)
|
||||
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_JSON))
|
||||
.finally(done);
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('withJSON with geoWithin.centerSphere fails with invalid distance', done => {
|
||||
@@ -4414,7 +4414,7 @@ describe('Parse.Query testing', () => {
|
||||
q.find()
|
||||
.then(done.fail)
|
||||
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_JSON))
|
||||
.finally(() => done());
|
||||
.then(done);
|
||||
});
|
||||
|
||||
it('withJSON with geoWithin.centerSphere fails with invalid coordinate', done => {
|
||||
@@ -4428,7 +4428,7 @@ describe('Parse.Query testing', () => {
|
||||
q.withJSON(jsonQ);
|
||||
q.find()
|
||||
.then(done.fail)
|
||||
.catch(done);
|
||||
.catch(() => done());
|
||||
});
|
||||
|
||||
it('withJSON with geoWithin.centerSphere fails with invalid geo point', done => {
|
||||
@@ -4442,6 +4442,6 @@ describe('Parse.Query testing', () => {
|
||||
q.withJSON(jsonQ);
|
||||
q.find()
|
||||
.then(done.fail)
|
||||
.catch(done);
|
||||
.catch(() => done());
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1225,10 +1225,10 @@ describe('Parse.User testing', () => {
|
||||
});
|
||||
|
||||
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(Parse.FacebookUtils.isLinked(req.user)).toBe(true);
|
||||
res.success();
|
||||
return 'ok';
|
||||
});
|
||||
|
||||
const provider = getMockFacebookProvider();
|
||||
|
||||
@@ -88,22 +88,18 @@ describe('SchemaController', () => {
|
||||
aRelation: { __type: 'Relation', className: 'Stuff' },
|
||||
});
|
||||
})
|
||||
.then(
|
||||
schema => {
|
||||
return schema
|
||||
.validateObject('Stuff', {
|
||||
aRelation: { __type: 'Pointer', className: 'Stuff' },
|
||||
})
|
||||
.then(() => {
|
||||
fail('expected invalidity');
|
||||
done();
|
||||
}, done);
|
||||
},
|
||||
err => {
|
||||
fail(err);
|
||||
done();
|
||||
}
|
||||
);
|
||||
.then(schema => {
|
||||
return schema
|
||||
.validateObject('Stuff', {
|
||||
aRelation: { __type: 'Pointer', className: 'Stuff' },
|
||||
})
|
||||
.then(
|
||||
() => {
|
||||
done.fail('expected invalidity');
|
||||
},
|
||||
() => done()
|
||||
);
|
||||
}, done.fail);
|
||||
});
|
||||
|
||||
it('rejects inconsistent types', done => {
|
||||
@@ -115,10 +111,13 @@ describe('SchemaController', () => {
|
||||
.then(schema => {
|
||||
return schema.validateObject('Stuff', { bacon: 'z' });
|
||||
})
|
||||
.then(() => {
|
||||
fail('expected invalidity');
|
||||
done();
|
||||
}, done);
|
||||
.then(
|
||||
() => {
|
||||
fail('expected invalidity');
|
||||
done();
|
||||
},
|
||||
() => done()
|
||||
);
|
||||
});
|
||||
|
||||
it('updates when new fields are added', done => {
|
||||
@@ -133,10 +132,13 @@ describe('SchemaController', () => {
|
||||
.then(schema => {
|
||||
return schema.validateObject('Stuff', { sausage: 'ate' });
|
||||
})
|
||||
.then(() => {
|
||||
fail('expected invalidity');
|
||||
done();
|
||||
}, done);
|
||||
.then(
|
||||
() => {
|
||||
fail('expected invalidity');
|
||||
done();
|
||||
},
|
||||
() => done()
|
||||
);
|
||||
});
|
||||
|
||||
it('class-level permissions test find', done => {
|
||||
|
||||
Reference in New Issue
Block a user