Skip to content

Commit 3a9e6d8

Browse files
committed
wip
1 parent cfa22d0 commit 3a9e6d8

9 files changed

+582
-512
lines changed

package-lock.json

+531-465
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"lru-cache": "4.1.3",
3434
"mime": "2.3.1",
3535
"mongodb": "3.1.4",
36-
"parse": "2.0.2",
36+
"parse": "2.1.0",
3737
"pg-promise": "8.4.6",
3838
"redis": "2.8.0",
3939
"request": "2.88.0",

spec/CloudCode.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ describe('Cloud Code', () => {
727727
.then(
728728
function() {
729729
const objAgain = new Parse.Object('BeforeDeleteTest', obj.id);
730-
return objAgain.fetch().then(fail, done);
730+
return objAgain.fetch().then(fail, () => done());
731731
},
732732
function(error) {
733733
fail(error);

spec/CloudCodeLogger.spec.js

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

spec/ParseObject.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('Parse.Object testing', () => {
9191
t.save().then(function() {
9292
t.destroy().then(function() {
9393
const t2 = new TestObject({ objectId: t.id });
94-
t2.fetch().then(fail, done);
94+
t2.fetch().then(fail, () => done());
9595
});
9696
});
9797
});
@@ -298,7 +298,7 @@ describe('Parse.Object testing', () => {
298298
!item.set({ 'foo^bar': 'baz' }),
299299
'Item should not be updated with invalid key.'
300300
);
301-
item.save({ 'foo^bar': 'baz' }).then(fail, done);
301+
item.save({ 'foo^bar': 'baz' }).then(fail, () => done());
302302
});
303303

304304
it('invalid __type', function(done) {
@@ -1189,7 +1189,7 @@ describe('Parse.Object testing', () => {
11891189
ok(!obj.dirty(), 'The object should not be dirty');
11901190
ok(obj.get('aDate'));
11911191
})
1192-
.finally(function() {
1192+
.then(function() {
11931193
restController.request = r;
11941194
done();
11951195
});
@@ -1216,7 +1216,7 @@ describe('Parse.Object testing', () => {
12161216
ok(obj.dirty(), 'The object should be dirty');
12171217
equal(now, obj.get('aDate'));
12181218
})
1219-
.finally(function() {
1219+
.then(function() {
12201220
restController.request = r;
12211221
done();
12221222
});

spec/ParsePolygon.spec.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,22 +115,22 @@ describe('Parse.Polygon testing', () => {
115115
const query = new Parse.Query(TestObject);
116116
return query.get(obj.id);
117117
})
118-
.then(done.fail, done);
118+
.then(done.fail, () => done());
119119
});
120120

121121
it('polygon three points minimum', done => {
122122
const coords = [[0, 0]];
123123
const obj = new TestObject();
124124
// use raw so we test the server validates properly
125125
obj.set('polygon', { __type: 'Polygon', coordinates: coords });
126-
obj.save().then(done.fail, done);
126+
obj.save().then(done.fail, () => done());
127127
});
128128

129129
it('polygon three different points minimum', done => {
130130
const coords = [[0, 0], [0, 1], [0, 0]];
131131
const obj = new TestObject();
132132
obj.set('polygon', new Parse.Polygon(coords));
133-
obj.save().then(done.fail, done);
133+
obj.save().then(done.fail, () => done());
134134
});
135135

136136
it('polygon counterclockwise', done => {
@@ -398,6 +398,6 @@ describe_only_db('mongo')('Parse.Polygon testing', () => {
398398
const coords = [[0, 0], [0, 1], [1, 0], [1, 1]];
399399
const obj = new TestObject();
400400
obj.set('polygon', new Parse.Polygon(coords));
401-
obj.save().then(done.fail, done);
401+
obj.save().then(done.fail, () => done());
402402
});
403403
});

spec/ParseQuery.spec.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -1360,7 +1360,7 @@ describe('Parse.Query testing', () => {
13601360
.find()
13611361
.then(done.fail)
13621362
.catch(error => expect(error.code).toBe(Parse.Error.INVALID_KEY_NAME))
1363-
.finally(done);
1363+
.then(done);
13641364
});
13651365

13661366
it('get', function(done) {
@@ -1387,7 +1387,7 @@ describe('Parse.Query testing', () => {
13871387
) {
13881388
ok(items[0]);
13891389
const query = new Parse.Query(TestObject);
1390-
query.get(undefined).then(fail, done);
1390+
query.get(undefined).then(fail, () => done());
13911391
});
13921392
});
13931393

@@ -1453,7 +1453,7 @@ describe('Parse.Query testing', () => {
14531453
.first()
14541454
.then(done.fail)
14551455
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME))
1456-
.finally(done);
1456+
.then(done);
14571457
});
14581458

14591459
const Container = Parse.Object.extend({
@@ -1821,7 +1821,7 @@ describe('Parse.Query testing', () => {
18211821
.find()
18221822
.then(done.fail)
18231823
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_KEY_NAME))
1824-
.finally(done);
1824+
.then(done);
18251825
});
18261826
});
18271827

@@ -2044,7 +2044,7 @@ describe('Parse.Query testing', () => {
20442044
.find()
20452045
.then(done.fail)
20462046
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_QUERY))
2047-
.finally(done);
2047+
.then(done);
20482048
});
20492049

20502050
it('Use a regex that requires all modifiers', function(done) {
@@ -4235,7 +4235,7 @@ describe('Parse.Query testing', () => {
42354235
obj1
42364236
.save({ useMasterKey: true })
42374237
.then(() => q.find({ useMasterKey: true }))
4238-
.then(done.fail, done);
4238+
.then(done.fail, () => done());
42394239
});
42404240

42414241
it_only_db('mongo')(
@@ -4252,7 +4252,7 @@ describe('Parse.Query testing', () => {
42524252
obj1
42534253
.save({ useMasterKey: true })
42544254
.then(() => q.find({ useMasterKey: true }))
4255-
.then(done.fail, done);
4255+
.then(done.fail, () => done());
42564256
}
42574257
);
42584258

@@ -4399,7 +4399,7 @@ describe('Parse.Query testing', () => {
43994399
q.find()
44004400
.then(done.fail)
44014401
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_JSON))
4402-
.finally(done);
4402+
.then(done);
44034403
});
44044404

44054405
it('withJSON with geoWithin.centerSphere fails with invalid distance', done => {
@@ -4414,7 +4414,7 @@ describe('Parse.Query testing', () => {
44144414
q.find()
44154415
.then(done.fail)
44164416
.catch(e => expect(e.code).toBe(Parse.Error.INVALID_JSON))
4417-
.finally(() => done());
4417+
.then(done);
44184418
});
44194419

44204420
it('withJSON with geoWithin.centerSphere fails with invalid coordinate', done => {
@@ -4428,7 +4428,7 @@ describe('Parse.Query testing', () => {
44284428
q.withJSON(jsonQ);
44294429
q.find()
44304430
.then(done.fail)
4431-
.catch(done);
4431+
.catch(() => done());
44324432
});
44334433

44344434
it('withJSON with geoWithin.centerSphere fails with invalid geo point', done => {
@@ -4442,6 +4442,6 @@ describe('Parse.Query testing', () => {
44424442
q.withJSON(jsonQ);
44434443
q.find()
44444444
.then(done.fail)
4445-
.catch(done);
4445+
.catch(() => done());
44464446
});
44474447
});

spec/ParseUser.spec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1225,10 +1225,10 @@ describe('Parse.User testing', () => {
12251225
});
12261226

12271227
it('user authData should be available in cloudcode (#2342)', async done => {
1228-
Parse.Cloud.define('checkLogin', (req, res) => {
1228+
Parse.Cloud.define('checkLogin', req => {
12291229
expect(req.user).not.toBeUndefined();
12301230
expect(Parse.FacebookUtils.isLinked(req.user)).toBe(true);
1231-
res.success();
1231+
return 'ok';
12321232
});
12331233

12341234
const provider = getMockFacebookProvider();

spec/Schema.spec.js

+26-24
Original file line numberDiff line numberDiff line change
@@ -88,22 +88,18 @@ describe('SchemaController', () => {
8888
aRelation: { __type: 'Relation', className: 'Stuff' },
8989
});
9090
})
91-
.then(
92-
schema => {
93-
return schema
94-
.validateObject('Stuff', {
95-
aRelation: { __type: 'Pointer', className: 'Stuff' },
96-
})
97-
.then(() => {
98-
fail('expected invalidity');
99-
done();
100-
}, done);
101-
},
102-
err => {
103-
fail(err);
104-
done();
105-
}
106-
);
91+
.then(schema => {
92+
return schema
93+
.validateObject('Stuff', {
94+
aRelation: { __type: 'Pointer', className: 'Stuff' },
95+
})
96+
.then(
97+
() => {
98+
done.fail('expected invalidity');
99+
},
100+
() => done()
101+
);
102+
}, done.fail);
107103
});
108104

109105
it('rejects inconsistent types', done => {
@@ -115,10 +111,13 @@ describe('SchemaController', () => {
115111
.then(schema => {
116112
return schema.validateObject('Stuff', { bacon: 'z' });
117113
})
118-
.then(() => {
119-
fail('expected invalidity');
120-
done();
121-
}, done);
114+
.then(
115+
() => {
116+
fail('expected invalidity');
117+
done();
118+
},
119+
() => done()
120+
);
122121
});
123122

124123
it('updates when new fields are added', done => {
@@ -133,10 +132,13 @@ describe('SchemaController', () => {
133132
.then(schema => {
134133
return schema.validateObject('Stuff', { sausage: 'ate' });
135134
})
136-
.then(() => {
137-
fail('expected invalidity');
138-
done();
139-
}, done);
135+
.then(
136+
() => {
137+
fail('expected invalidity');
138+
done();
139+
},
140+
() => done()
141+
);
140142
});
141143

142144
it('class-level permissions test find', done => {

0 commit comments

Comments
 (0)