Skip to content

JS SDK 2.1 #5043

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,053 changes: 2,519 additions & 2,534 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"lru-cache": "4.1.3",
"mime": "2.3.1",
"mongodb": "3.1.4",
"parse": "2.0.2",
"parse": "2.1.0",
"pg-promise": "8.4.6",
"redis": "2.8.0",
"request": "2.88.0",
Expand Down
2 changes: 1 addition & 1 deletion spec/CloudCode.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions spec/CloudCodeLogger.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions spec/ParseObject.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
});
});
});
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
});
Expand All @@ -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();
});
Expand Down
8 changes: 4 additions & 4 deletions spec/ParsePolygon.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,22 @@ 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 => {
const coords = [[0, 0]];
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 => {
Expand Down Expand Up @@ -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());
});
});
22 changes: 11 additions & 11 deletions spec/ParseQuery.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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());
});
});

Expand Down Expand Up @@ -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({
Expand Down Expand Up @@ -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);
});
});

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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')(
Expand All @@ -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());
}
);

Expand Down Expand Up @@ -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 => {
Expand All @@ -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 => {
Expand All @@ -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 => {
Expand All @@ -4442,6 +4442,6 @@ describe('Parse.Query testing', () => {
q.withJSON(jsonQ);
q.find()
.then(done.fail)
.catch(done);
.catch(() => done());
});
});
4 changes: 2 additions & 2 deletions spec/ParseUser.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
50 changes: 26 additions & 24 deletions spec/Schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand All @@ -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 => {
Expand All @@ -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 => {
Expand Down