Skip to content

Commit 62a88f6

Browse files
committed
Merge branch 'upstream/master' into moumouls/auth-adapter-spec
# Conflicts: # package.json # src/GraphQL/loaders/parseClassTypes.js
2 parents c2e9e3c + 033a0bd commit 62a88f6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1369
-2543
lines changed

package-lock.json

Lines changed: 24 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
"intersect": "1.0.1",
4444
"jsonwebtoken": "8.5.1",
4545
"jwks-rsa": "1.11.0",
46-
"ldapjs": "2.2.1",
46+
"ldapjs": "2.2.2",
4747
"lodash": "4.17.20",
4848
"lru-cache": "5.1.1",
4949
"mime": "2.4.6",
50-
"mongodb": "3.6.2",
51-
"parse": "2.18.0",
50+
"mongodb": "3.6.3",
51+
"parse": "2.19.0",
5252
"pg-promise": "10.8.1",
5353
"pluralize": "8.0.0",
5454
"redis": "3.0.2",
@@ -106,7 +106,7 @@
106106
"posttest": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.0.4} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=mmapv1} mongodb-runner stop",
107107
"coverage": "cross-env MONGODB_VERSION=${MONGODB_VERSION:=4.0.4} MONGODB_TOPOLOGY=${MONGODB_TOPOLOGY:=standalone} MONGODB_STORAGE_ENGINE=${MONGODB_STORAGE_ENGINE:=mmapv1} TESTING=1 nyc jasmine",
108108
"start": "node ./bin/parse-server",
109-
"prettier": "prettier --write {src,spec}/{**/*,*}.js && npm run lint-fix",
109+
"prettier": "prettier --write '{src,spec}/{**/*,*}.js' && npm run lint-fix",
110110
"prepare": "npm run build",
111111
"postinstall": "node -p 'require(\"./postinstall.js\")()'"
112112
},

spec/CloudCode.spec.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,21 @@ describe('Cloud Code', () => {
216216
);
217217
});
218218

219+
it('test beforeSave with invalid field', async () => {
220+
Parse.Cloud.beforeSave('BeforeSaveChanged', function (req) {
221+
req.object.set('length', 0);
222+
});
223+
224+
const obj = new Parse.Object('BeforeSaveChanged');
225+
obj.set('foo', 'bar');
226+
try {
227+
await obj.save();
228+
fail('should not succeed');
229+
} catch (e) {
230+
expect(e.message).toBe('Invalid field name: length.');
231+
}
232+
});
233+
219234
it("test beforeSave changed object fail doesn't change object", async function () {
220235
Parse.Cloud.beforeSave('BeforeSaveChanged', function (req) {
221236
if (req.object.has('fail')) {

spec/ParseObject.spec.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -701,29 +701,24 @@ describe('Parse.Object testing', () => {
701701
});
702702
});
703703

704-
it('length attribute', function (done) {
704+
it('acl attribute', function (done) {
705705
Parse.User.signUp('bob', 'password').then(function (user) {
706706
const TestObject = Parse.Object.extend('TestObject');
707707
const obj = new TestObject({
708-
length: 5,
709708
ACL: new Parse.ACL(user), // ACLs cause things like validation to run
710709
});
711-
equal(obj.get('length'), 5);
712710
ok(obj.get('ACL') instanceof Parse.ACL);
713711

714712
obj.save().then(function (obj) {
715-
equal(obj.get('length'), 5);
716713
ok(obj.get('ACL') instanceof Parse.ACL);
717714

718715
const query = new Parse.Query(TestObject);
719716
query.get(obj.id).then(function (obj) {
720-
equal(obj.get('length'), 5);
721717
ok(obj.get('ACL') instanceof Parse.ACL);
722718

723719
const query = new Parse.Query(TestObject);
724720
query.find().then(function (results) {
725721
obj = results[0];
726-
equal(obj.get('length'), 5);
727722
ok(obj.get('ACL') instanceof Parse.ACL);
728723

729724
done();
@@ -733,6 +728,21 @@ describe('Parse.Object testing', () => {
733728
});
734729
});
735730

731+
it('cannot save object with invalid field', async () => {
732+
const invalidFields = ['className', 'length'];
733+
const promises = invalidFields.map(async field => {
734+
const obj = new TestObject();
735+
obj.set(field, 'bar');
736+
try {
737+
await obj.save();
738+
fail('should not succeed');
739+
} catch (e) {
740+
expect(e.message).toBe(`Invalid field name: ${field}.`);
741+
}
742+
});
743+
await Promise.all(promises);
744+
});
745+
736746
it('old attribute unset then unset', function (done) {
737747
const TestObject = Parse.Object.extend('TestObject');
738748
const obj = new TestObject();

spec/ParseQuery.spec.js

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2860,33 +2860,6 @@ describe('Parse.Query testing', () => {
28602860
});
28612861
});
28622862

2863-
it('object with length', function (done) {
2864-
const TestObject = Parse.Object.extend('TestObject');
2865-
const obj = new TestObject();
2866-
obj.set('length', 5);
2867-
equal(obj.get('length'), 5);
2868-
obj.save().then(
2869-
function () {
2870-
const query = new Parse.Query(TestObject);
2871-
query.find().then(
2872-
function (results) {
2873-
equal(results.length, 1);
2874-
equal(results[0].get('length'), 5);
2875-
done();
2876-
},
2877-
function (error) {
2878-
ok(false, error.message);
2879-
done();
2880-
}
2881-
);
2882-
},
2883-
function (error) {
2884-
ok(false, error.message);
2885-
done();
2886-
}
2887-
);
2888-
});
2889-
28902863
it('include user', function (done) {
28912864
Parse.User.signUp('bob', 'password', { age: 21 }).then(function (user) {
28922865
const TestObject = Parse.Object.extend('TestObject');

0 commit comments

Comments
 (0)