We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f0aba55 commit 7855740Copy full SHA for 7855740
spec/CloudCode.spec.js
@@ -2410,6 +2410,18 @@ describe('afterFind hooks', () => {
2410
expect(pointer.get('foo')).toBe('bar');
2411
});
2412
2413
+ it('can set invalid object in afterFind', async () => {
2414
+ const obj = new Parse.Object('MyObject');
2415
+ await obj.save();
2416
+ Parse.Cloud.afterFind('MyObject', () => [{}]);
2417
+ const query = new Parse.Query('MyObject');
2418
+ query.equalTo('objectId', obj.id);
2419
+ const obj2 = await query.first();
2420
+ expect(obj2).toBeDefined();
2421
+ expect(obj2.toJSON()).toEqual({});
2422
+ expect(obj2.id).toBeUndefined();
2423
+ });
2424
+
2425
it('can return a unsaved object in afterFind', async () => {
2426
const obj = new Parse.Object('MyObject');
2427
await obj.save();
0 commit comments